private static function _validateHasNotChildWithStaticHome($cls, array &$validated = array())
 {
     if (isset($validated[$cls])) {
         return;
     }
     $validated[$cls] = true;
     foreach (Kwf_Component_Generator_Abstract::getOwnInstances($cls) as $g) {
         if ($g instanceof Kwf_Component_Generator_Page_StaticHome) {
             throw new Kwf_Exception("'{$cls}' must not have StaticHome, either remove StaticHome, remove category generator or disable hasHome for Category/Generator");
         }
     }
     foreach (Kwc_Abstract::getChildComponentClasses($cls) as $c) {
         self::_validateHasNotChildWithStaticHome($c, $validated);
     }
 }
Esempio n. 2
0
 /**
  * Returns child components matching the given select
  *
  * @param array|Kwf_Component_Select
  * @return Kwf_Component_Data[]
  */
 public function getChildComponents($select = array())
 {
     $select = $this->_formatSelect($select);
     $sc = $select->getHash();
     if (isset($this->_childComponentsCache[$sc])) {
         Kwf_Benchmark::count('getChildComponents cached');
     } else {
         Kwf_Benchmark::count('getChildComponents uncached');
     }
     if (!isset($this->_childComponentsCache[$sc])) {
         $this->_childComponentsCache[$sc] = array();
         if ($select->getPart(Kwf_Component_Select::WHERE_COMPONENT_CLASSES) === array()) {
             return $this->_childComponentsCache[$sc];
             //vorzeitig abbrechen, da kommt sicher kein ergebnis
         }
         if ($select->hasPart(Kwf_Component_Select::LIMIT_COUNT)) {
             $limitCount = $select->getPart(Kwf_Component_Select::LIMIT_COUNT);
         } else {
             $limitCount = null;
         }
         $generators = Kwf_Component_Generator_Abstract::getOwnInstances($this, $select);
         $ret = $this->_getChildComponentsFromGenerators($generators, $select, $limitCount);
         if (is_null($limitCount) || count($ret) < $limitCount) {
             //wenn limit nicht erreicht, inherited generator auch noch fragen
             if (!is_null($limitCount)) {
                 $limitCount -= count($ret);
             }
             $generators = Kwf_Component_Generator_Abstract::getInheritedInstances($this, $select);
             $ret += $this->_getChildComponentsFromGenerators($generators, $select, $limitCount);
             //kein array_merge, da wuerden die keys verloren gehen - und die sind eh eindeutig
         }
         $this->_childComponentsCache[$sc] = $ret;
     }
     return $this->_childComponentsCache[$sc];
 }