/** * Creates a model instance * * @see Atomik_Model::__construct() * @param array $values * @param bool $new * @return Atomik_Model */ public function createInstance($values = array(), $new = true) { $className = $this->className; if ($className === null) { /** Atomik_Model */ require_once 'Atomik/Model.php'; $className = 'Atomik_Model'; } $dataToFilter = array_intersect_key($values, $this->_fields); $data = array_diff_key($values, $this->_fields); foreach ($dataToFilter as $key => $value) { $data[$key] = $this->_fields[$key]->filterInput($value); } $this->_behaviourBroker->notifyBeforeCreateInstance($this, $data, $new); $instance = new $className($data, $new, $this); $this->_behaviourBroker->notifyAfterCreateInstance($this, $instance); return $instance; }
/** * Notify behaviour brokers * * @param Atomik_Model_Builder $builder * @param string $event * @param array $args */ protected function _notify(Atomik_Model_Builder $builder, $event, $args) { array_unshift($args, $builder); $this->_globalBehaviourBroker->notify($event, $args); $builder->getBehaviourBroker()->notify($event, $args); }