Example #1
0
 /**
  * Makes sure that an entity model for the given class is loaded
  * or, if the class name is not specified, make sure that all entity models are loaded
  *
  * @param string|null $className
  */
 protected function ensureEntityCacheWarmed($className = null)
 {
     if ($this->lockObject->isLocked()) {
         return;
     }
     if (null === $this->entities) {
         $this->entities = [];
     }
     if ($className) {
         if (!array_key_exists($className, $this->entities)) {
             $this->entities[$className] = !$this->entitiesAreLoaded ? $this->loadEntityModel($className) : null;
         }
     } elseif (!$this->entitiesAreLoaded) {
         $entityModels = $this->loadEntityModels();
         foreach ($entityModels as $model) {
             $this->entities[$model->getClassName()] = $model;
         }
         $this->entitiesAreLoaded = true;
     }
 }