/**
  * Returns an instance of class (singleton pattern implementation).
  *
  * @return BOL_ComponentEntityPlaceDao
  */
 public static function getInstance()
 {
     if (self::$classInstance === null) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
 public function onEntityDelete($place, $entityId)
 {
     $placeId = $this->findPlaceId($place);
     $adminCmps = BOL_ComponentAdminService::getInstance()->findPlaceComponentList($place);
     $entityCmps = $this->findPlaceComponentList($place, $entityId);
     $placeComponents = array_merge($adminCmps, $entityCmps);
     $uniqNames = array();
     foreach ($placeComponents as $uniqName => $item) {
         $uniqNames[] = $uniqName;
     }
     $this->componentPositionDao->deleteByUniqNameList($entityId, $uniqNames);
     $this->componentSettingDao->deleteByUniqNameList($entityId, $uniqNames);
     $this->componentPlaceDao->deleteList($placeId, $entityId);
     $this->componentPlaceCacheDao->deleteCache($placeId, $entityId);
 }
 public function findSectionPositionIdList($placeId, $entityId, $section)
 {
     $componentPlaceDao = BOL_ComponentPlaceDao::getInstance();
     $componentEntityPlaceDao = BOL_ComponentEntityPlaceDao::getInstance();
     $query = '
     	SELECT `p`.`id` FROM `' . $this->getTableName() . '` AS `p`
     	INNER JOIN ( 
         	( SELECT `uniqName` FROM `' . $componentPlaceDao->getTableName() . '`
         		WHERE `placeId`=:placeId )
         	UNION
         	( SELECT `uniqName` FROM `' . $componentEntityPlaceDao->getTableName() . '`
         		WHERE `placeId`=:placeId AND `entityId`=:entityId )
     	) AS `c` ON `p`.`componentPlaceUniqName` = `c`.`uniqName` AND `section`=:section AND `p`.`entityId`=:entityId
     ';
     return $this->dbo->queryForColumnList($query, array('placeId' => $placeId, 'entityId' => $entityId, 'section' => $section));
 }
Example #4
0
 public function deleteWidgetPlace($uniqName)
 {
     $componentPlaceDao = BOL_ComponentPlaceDao::getInstance();
     $dto = $componentPlaceDao->findByUniqName($uniqName);
     if ($dto === null) {
         return;
     }
     $componentPlaceDao->deleteByUniqName($dto->uniqName);
     BOL_ComponentEntityPlaceDao::getInstance()->deleteAllByUniqName($dto->uniqName);
     BOL_ComponentSettingDao::getInstance()->deleteList($dto->uniqName);
     BOL_ComponentEntitySettingDao::getInstance()->deleteAllByUniqName($dto->uniqName);
     BOL_ComponentPositionDao::getInstance()->deleteByUniqName($dto->uniqName);
     BOL_ComponentEntityPositionDao::getInstance()->deleteAllByUniqName($dto->uniqName);
     $this->componentPlaceCacheDao->deleteAllCache($dto->placeId);
     $this->componentDao->delete($dto);
 }