public static final function __initEntity(Entity $Entity) { $className = get_called_class(); if (!isset(self::$_arDBSimpleEntities[$className])) { if ($Entity instanceof Entity) { self::$_arDBSimpleEntities[$className] = $Entity; self::setMessagePool($Entity->getMessagePool()); } } }
/** * Проверяет заполнены ли все поля указанного unique-индекса * @param array &$fields * @param string &$indexName * @return bool */ private function _checkUniqueIndex(&$fields, &$indexName = null) { static $uniqueIndexList = null; if (null === $uniqueIndexList) { $uniqueIndexList = $this->entity->getTableUnique(); } if (null !== $indexName) { if (!array_key_exists($indexName, $uniqueIndexList)) { $indexName = null; } } if (null === $indexName) { foreach ($uniqueIndexList as $uniqueName => &$indexFieldsList) { foreach ($indexFieldsList as $fieldCode) { if (!array_key_exists($fieldCode, $fields)) { return false; } } $indexName = $uniqueName; } } else { foreach ($uniqueIndexList[$indexName] as $fieldCode) { if (!array_key_exists($fieldCode, $fields)) { return false; } } } return true; }