Пример #1
0
 /**
  * add entity to module
  * @access public
  * @param Ultimate_ModuleCreator_Model_Entity $entity
  * @return Ultimate_ModuleCreator_Model_Module
  * @author Marius Strajeru <*****@*****.**>
  */
 public function addEntity(Ultimate_ModuleCreator_Model_Entity $entity)
 {
     if (isset($this->_entities[$entity->getNameSingular()])) {
         throw new Ultimate_ModuleCreator_Exception(Mage::helper('modulecreator')->__('An entity with the code "%s" already exists', $entity->getNameSingular()));
     }
     $entity->setModule($this);
     $position = 10 * count($this->_entities);
     $entity->setPosition($position);
     $this->_entities[$entity->getNameSingular()] = $entity;
     if ($entity->getRss()) {
         $this->setRss(true);
     }
     if ($entity->getAddStatus()) {
         $this->setAddStatus(true);
     }
     if ($entity->getHasFile()) {
         $this->setHasFile(true);
     }
     if ($entity->getHasImage()) {
         $this->setHasImage(true);
     }
     if ($entity->getFrontendAddSeo()) {
         $this->setFrontendAddSeo(true);
     }
     if ($entity->getWidget()) {
         $this->setWidget(true);
     }
     if ($entity->getUseFrontend()) {
         $this->setUseFrontend(true);
     }
     if ($entity->getFrontendList()) {
         $this->setFrontendList(true);
     }
     if ($entity->getLinkProduct()) {
         $this->setHasObserver(true);
         $this->setLinkProduct(true);
     }
     if ($entity->getIsTree()) {
         $this->setHasTree(true);
     }
     if ($entity->getEditor()) {
         $this->setEditor(true);
     }
     if ($entity->getUrlRewrite()) {
         $this->setUrlRewrite(true);
     }
     if ($entity->getAdminSearch()) {
         $this->setAdminSearch(true);
     }
     if ($entity->getCreateApi()) {
         $this->setCreateApi(true);
     }
     return $this;
 }