Exemplo n.º 1
0
 /**
  * @param string $className
  * @return bool
  */
 public function supports($className)
 {
     return !ConfigHelper::isConfigModelEntity($className) && $this->extendConfigProvider->hasConfig($className) && $this->extendConfigProvider->getConfig($className)->is('is_extend');
 }
Exemplo n.º 2
0
 /**
  * Finds a model for an entity field
  *
  * @param string $className
  * @param string $fieldName
  *
  * @return FieldConfigModel|null An instance of FieldConfigModel or null if a model was not found
  */
 public function findFieldModel($className, $fieldName)
 {
     if (empty($className) || empty($fieldName) || ConfigHelper::isConfigModelEntity($className)) {
         return null;
     }
     $this->ensureFieldCacheWarmed($className);
     $result = null;
     // check if a model exists in the local cache
     if (isset($this->fields[$className]) && array_key_exists($fieldName, $this->fields[$className])) {
         $result = $this->fields[$className][$fieldName];
         if ($result && $this->isEntityDetached($result)) {
             // the detached model must be reloaded
             $this->entities[$className] = false;
             unset($this->fields[$className]);
             $result = $this->findFieldModel($className, $fieldName);
         }
     }
     return $result;
 }
Exemplo n.º 3
0
 /**
  * @dataProvider isConfigModelEntityProvider
  */
 public function testIsConfigModelEntity($className, $expected)
 {
     $result = ConfigHelper::isConfigModelEntity($className);
     $this->assertEquals($expected, $result);
 }