Example #1
0
 public function lazyInitialize()
 {
     if ($this->lazy_initialized) {
         throw new \Exception('big error');
     }
     $this->lazy_initialized = true;
     $orm_map = array();
     foreach ($this->reflection->getProperties() as $p) {
         if ($p instanceof \ReflectionProperty) {
             $map = $this->getPropertyDoctrineAssociationMapping($p->name);
             if ($map) {
                 $target_class = $map['targetEntity'];
                 $target_admin = null;
                 $target_admin_name = null;
                 if ($this->generator->hasAdminClass($target_class)) {
                     $target_admin = $this->generator->getAdminByClass($target_class);
                     $target_admin_name = $target_admin->name;
                 }
                 if ($map['type'] === \Doctrine\ORM\Mapping\ClassMetadataInfo::ONE_TO_MANY && $this->tree) {
                     if ($map['mappedBy'] === $this->tree['parent']) {
                         if (isset($this->tree['children'])) {
                             throw new \Exception('error');
                         }
                         $this->tree['children'] = $p->getName();
                     }
                 }
                 $orm_map[$p->name] = array($target_class, $target_admin_name, $map['type']);
             }
         }
     }
     $this->_orm_map = $orm_map;
     $this->_route_assoc->lazyInitialize();
     $this->getLabel();
     if ($this->owner) {
         $this->owner->lazyInitialize();
     }
     if ($this->page) {
         $this->page->lazyInitialize();
     }
     if ($this->workflow) {
         // lazyInitialize before form ?
         $this->workflow->lazyInitialize();
     }
     $this->form->lazyInitialize();
     $this->form_initialized = true;
     $this->action_collection->lazyInitialize();
 }