/var/www/vhosts/ihelp.ro/_OLD/vendor/cakephp/cakephp/src/ORM/Rule
NameSizeModeActions
ExistsIn.php55320644editdlrm
IsUnique.php25970644editdlrm
LinkConstraint.php61660644editdlrm
ValidCount.php16850644editdlrm
Edit: /var/www/vhosts/ihelp.ro/_OLD/vendor/cakephp/cakephp/src/ORM/Rule/IsUnique.php (2597B)
_fields = $fields; } /** * Performs the uniqueness check * * @param \Cake\Datasource\EntityInterface $entity The entity from where to extract the fields * where the `repository` key is required. * @param array $options Options passed to the check, * @return bool */ public function __invoke(EntityInterface $entity, array $options): bool { if (!$entity->extract($this->_fields, true)) { return true; } $alias = $options['repository']->getAlias(); $conditions = $this->_alias($alias, $entity->extract($this->_fields)); if ($entity->isNew() === false) { $keys = (array)$options['repository']->getPrimaryKey(); $keys = $this->_alias($alias, $entity->extract($keys)); if (array_filter($keys, 'strlen')) { $conditions['NOT'] = $keys; } } return !$options['repository']->exists($conditions); } /** * Add a model alias to all the keys in a set of conditions. * * @param string $alias The alias to add. * @param array $conditions The conditions to alias. * @return array */ protected function _alias(string $alias, array $conditions): array { $aliased = []; foreach ($conditions as $key => $value) { $aliased["$alias.$key IS"] = $value; } return $aliased; } }