public function validate() { $result = parent::validate(); $settings = $this->getSettingsValues(); if (isset($settings['field_settings'])) { $field = $this->getField($this->getSettingsValues()); $settings_result = $field->validateSettingsForm($settings['field_settings']); if ($settings_result instanceof ValidationResult && $settings_result->failed()) { foreach ($settings_result->getFailed() as $name => $rules) { foreach ($rules as $rule) { $result->addFailed($name, $rule); } } } } return $result; }
public function getInverse(Model $model) { $inverse_name = $this->getInverseName(); return $model->getAssociation($inverse_name); }
/** * */ public function markLinkAsClean(Model $source, Model $target) { list($_, $to) = $this->getKeys(); $target->markAsClean($to); }
/** * */ public function markLinkAsClean(Model $source, Model $target) { list($from, $_) = $this->getKeys(); $source->markAsClean($from); }
protected function constrainQueryToSelf($query) { if ($this->isDirty('site_id')) { throw new LogicException('Cannot modify site_id.'); } $query->filter('site_id', $this->site_id); parent::constrainQueryToSelf($query); }
/** * Prep the model associations * * @param Model $model Model to initialize */ protected function initializeAssociationsOn(Model $model) { $relations = $this->getAllRelations($model->getName()); foreach ($relations as $name => $relation) { $assoc = $relation->createAssociation($model); $model->setAssociation($name, $assoc); } }
/** * Returns the propety value using the overrides if present * * @param str $name The name of the property to fetch * @throws InvalidArgumentException if the property does not exist * @return mixed The value of the property */ public function __get($name) { $value = parent::__get($name); // Check if have an override for this directory and that it's an // array (as it should be) if (isset($this->_property_overrides[$this->id]) && is_array($this->_property_overrides[$this->id]) && array_key_exists($name, $this->_property_overrides[$this->id])) { $value = $this->_property_overrides[$this->id][$name]; } return $value; }