/** * Resolves a JOIN clause checking if the associated models exist * * @param \Phalcon\Mvc\Model\ManagerInterface $manager * @param array $join * @return array * @throws Exception */ protected function _getJoin(ManagerInterface $manager, array $join) { if (isset($join['qualified']) === true && $join['qualified']['type'] === 355) { return array($model->getSchema(), $model->getSource(), $join['qualified']['name'], $manager->load($join['qualified']['name'])); } throw new Exception('Corrupted SELECT AST'); }
/** * @param Event $event * @param ModelManagerInterface $modelsManager * @param ModelInterface $model */ public function afterInitialize(Event $event, ModelManagerInterface $modelsManager, ModelInterface $model) { $modelsManager->keepSnapshots($model, $this->keepSnapshots); }
/** * Handles method calls when a method is not implemented * * @param string $method * @param array|null $arguments * @return mixed * @throws Exception */ public function __call($method, $arguments = null) { if (is_string($method) === false) { throw new Exception('Invalid parameter type.'); } if (is_null($arguments) === true) { $arguments = array(); } elseif (is_array($arguments) === false) { throw new Exception('Invalid parameter type.'); } //Check if there is a default action using the magic getter $records = $this->_getRelatedRecords(__CLASS__, $method, $arguments); if (is_null($records) === false) { return $records; } //Try to find a replacement for the missing method in a behavior/listener $status = $this->_modelsManager->missingMethod($this, $method, $arguments); if (is_null($status) === false) { return $status; } //The method doesn't exist - throw an exception throw new Exception('The method "' . $method . '" doesn\'t exist on model "' . __CLASS__ . '"'); }
/** * @param Event $event * @param ModelManagerInterface $modelsManager * @param ModelInterface $model */ public function afterInitialize(Event $event, ModelManagerInterface $modelsManager, ModelInterface $model) { $className = get_class($model); $className = str_replace("\\", "_", $className); $modelsManager->setModelSource($model, $className); }
/** * @param Event $event * @param ModelManagerInterface $modelsManager * @param ModelInterface $model */ public function afterInitialize(Event $event, ModelManagerInterface $modelsManager, ModelInterface $model) { $modelsManager->useDynamicUpdate($model, $this->dynamicUpdate); }