public function create($query, array $options = []) {
		$params = compact('query', 'options');

		return Filters::run($this, __FUNCTION__, $params, function($params) {
			$query = $params['query'];
			$model = $entity = $object = $id = null;

			if (is_object($query)) {
				$object = $query;
				$model = $query->model();
				$params = $query->export($this);
				$entity =& $query->entity();
				$query = $this->renderCommand('create', $params, $query);
			} else {
				$query = Text::insert($query, $this->value($params['options']));
			}

			if (!$this->_execute($query)) {
				return false;
			}

			if ($entity) {
				if (($model) && !$model::key($entity)) {
					$id = $this->_insertId($object);
				}
				$entity->sync($id);
			}
			return true;
		});
	}
public function create($query, array $options = []) {
		$params = compact('query', 'options');

		return Filters::run($this, __FUNCTION__, $params, function($params) {
			$query = $params['query'];
			$model = $entity = $object = $id = null;

			if (is_object($query)) {
				$object = $query;
				$model = $query->model();
				$params = $query->export($this);
				$entity =& $query->entity();
				$query = $this->renderCommand('create', $params, $query);
			} else {
				$query = Text::insert($query, $this->value($params['options']));
			}

			if (!$this->_execute($query)) {
				return false;
			}

			if ($entity) {
				if (($model) && !$model::key($entity)) {
					$id = $this->_insertId($object);
				}
				$entity->sync($id);
			}
			return true;
		});
	}
public function create ( $ query , array $ options = [ ] ) { $ params = compact ( 'query' , 'options' ) ; return Filters :: run ( $ this , __FUNCTION__ , $ params , function ( $ params ) { $ query = $ params [ 'query' ] ; $ model = $ entity = $ object = $ id = null ; if ( is_object ( $ query ) ) { $ object = $ query ; $ model = $ query -> model ( ) ; $ params = $ query -> export ( $ this ) ; $ entity = & $ query -> entity ( ) ; $ query = $ this -> renderCommand ( 'create' , $ params , $ query ) ; } else { $ query = Text :: insert ( $ query , $ this -> value ( $ params [ 'options' ] ) ) ; } if ( ! $ this -> _execute ( $ query ) ) { return false ; } if ( $ entity ) { if ( ( $ model ) && ! $ model :: key ( $ entity ) ) { $ id = $ this -> _insertId ( $ object ) ; } $ entity -> sync ( $ id ) ; } return true ; } ) ; }
Inserts a new record into the database based on a the `Query`. The record is updated
with the id of the insert.

@see lithium\util\Text::insert()
@param object $query An SQL query string, or `lithium\data\model\Query` object instance.
@param array $options If $query is a string, $options contains an array of bind values to be
escaped, quoted, and inserted into `$query` using `Text::insert()`.
@return boolean Returns `true` if the query succeeded, otherwise `false`.
@filter
Inserts a new record into the database based on a the Query . The record is updated with the id of the insert .