public function __construct(Entity $admin, $property, Annotation\Owner $annot) { $map = $admin->getPropertyDoctrineAssociationMapping($property); if (!$map) { $this->throwError("property:%s should set @Doctrine\\ORM\\Mapping\\OneToOne(targetEntity=%s)", $property, self::PAGE_ENTITY_CLASS); } if (self::USER_ENTITY_CLASS !== $map['targetEntity']) { $this->throwError("property:%s should set @Doctrine\\ORM\\Mapping\\ManyToOne(targetEntity=%s), you set to:%s", $property, self::USER_ENTITY_CLASS, $map['targetEntity']); } $this->setAdminObject($admin); $this->owner_property = $property; $this->setMyPropertie($annot); }
public function __construct(Entity $admin, $property, Annotation\Page $annot) { if ($admin->class_name === self::PAGE_ENTITY_CLASS) { $this->throwError("can not set Page for entity:%s", self::PAGE_ENTITY_CLASS, $property); } $map = $admin->getPropertyDoctrineAssociationMapping($property); if (!$map) { if ($admin->orm_metadata->hasField($property)) { $orm_type = $admin->orm_metadata->orm_metadata->getTypeOfField($property); $this->throwError("property:%s can not use orm type(%s)", $property, $orm_type); } else { /** * single page without OneToOne map , need set a parent id for this collection */ } } else { if (self::PAGE_ENTITY_CLASS === $map['targetEntity']) { /** * single page with OneToOne map, need set a parent id for this collection */ if (\Doctrine\ORM\Mapping\ClassMetadataInfo::ONE_TO_ONE !== $map['type']) { $this->throwError("property:%s map to %s must be One2One, you use %s", $property, self::PAGE_ENTITY_CLASS, $map['type']); } if (self::PAGE_ENTITY_CLASS === $admin->class_name) { $this->throwError("property:%s can not use Page(%s) to it self", $property, self::PAGE_ENTITY_CLASS); } $this->page_one2one_map = true; } else { $this->parent_entity = $map['targetEntity']; } } $this->page_property = $property; $this->setAdminObject($admin); $this->setMyPropertie($annot); if (!$this->title_property) { if ($admin->property_value_name) { $this->title_property = $admin->property_value_name; } else { // $this->throwError("page must set a title property"); } } if (!$this->controller) { $controller = preg_replace('/\\\\Entity\\\\(\\w+)$/', '\\\\Controller\\\\\\1Controller', $admin->class_name); if (class_exists($controller)) { $this->set_controller($controller); } } $this->_compile_class_name = $admin->_compile_class_name . 'WebPageGenerator'; }
public function __construct(Entity $admin, $property, Annotation\Column $annot) { $map = $admin->getPropertyDoctrineAssociationMapping($property); if (!$map) { $this->throwError("property:%s should set @Doctrine\\ORM\\Mapping\\OneToOne(targetEntity=%s)", $property, self::PAGE_ENTITY_CLASS); } else { if (self::PAGE_ENTITY_CLASS !== $map['targetEntity']) { $this->throwError("property:%s should set @Doctrine\\ORM\\Mapping\\OneToOne(targetEntity=%s), you set to:%s", $property, self::PAGE_ENTITY_CLASS, $map['targetEntity']); } } $this->setAdminObject($admin); $this->column_property = $property; $this->setMyPropertie($annot); if (!$this->title_property) { if (!$admin->property_value_name) { $this->throwError("page must set a title property"); } $this->title_property = $admin->property_value_name; } }
/** * * @return array */ public function getPropertyDoctrineAssociationMapping() { return $this->admin_object->getPropertyDoctrineAssociationMapping($this->class_property); }