/** * * @param Yada_Meta $meta * @param Yada_Model $model * @param <type> $values */ public function __construct(Yada_Meta $meta, Yada_Model $model, $values = NULL) { // Store the meta and model objects for reference $this->_meta = $meta; $this->_model = $model; $this->_index = $meta->index($model); $this->_linked = new SplObjectStorage(); $values = isset($values) ? $values : array(); if (empty($values)) { $this->_state = 'new'; } else { $this->_state = 'changed'; } // Create some new meta properties to store mapper data.. $meta->values = new ArrayObject($values, ArrayObject::ARRAY_AS_PROPS); $meta->related = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS); $meta->clauses = new ArrayObject($meta->clauses); $meta->select = new ArrayObject(array()); $exclude = new SplObjectStorage(); $exclude->attach($model, new ArrayObject($meta->exclude)); $meta->exclude = $exclude; // Register with the model $this->export($model); }