/** * Returns a newly-created `Document` object, bound to a model and populated with default data * and options. * * @param string $model A fully-namespaced class name representing the model class to which the * `Document` object will be bound. * @param array $data The default data with which the new `Document` should be populated. * @param array $options Any additional options to pass to the `Document`'s constructor * @return object Returns a new, un-saved `Document` object bound to the model class specified * in `$model`. */ public function item($model, array $data = array(), array $options = array()) { return parent::item($model, $this->_format($data), $options); }
/** * Returns a newly-created `Document` object, bound to a model and populated with default data * and options. * * @param string $model A fully-namespaced class name representing the model class to which the * `Document` object will be bound. * @param array $data The default data with which the new `Document` should be populated. * @param array $options Any additional options to pass to the `Document`'s constructor * @return object Returns a new, un-saved `Document` object bound to the model class specified * in `$model`. */ public function item($model, array $data = array(), array $options = array()) { if (isset($data['doc'])) { return parent::item($model, $this->_format($data['doc']), $options); } if (isset($data['value'])) { return parent::item($model, $this->_format($data['value']), $options); } return parent::item($model, $this->_format($data), $options); }
/** * Returns a newly-created `Document` object, bound to a model and populated with default data * and options. * * @param string $model A fully-namespaced class name representing the model class to which the * `Document` object will be bound. * @param array $data The default data with which the new `Document` should be populated. * @param array $options Any additional options to pass to the `Document`'s constructor * @return object Returns a new, un-saved `Document` object bound to the model class specified * in `$model`. */ public function item($model, array $data = array(), array $options = array()) { $defaults = array('class' => 'entity'); $options += $defaults; if (isset($data['doc'])) { return parent::item($model, $this->_format($data['doc']), $options); } if (isset($data['value'])) { $data = $data['value']; } if (isset($options['class']) && $options['class'] === 'entity') { $data = $this->_format($data); } return parent::item($model, $data, $options); }