コード例 #1
0
ファイル: ModelPageModel.php プロジェクト: humansky/qframe
 /**
  * Instantiate a new ModelPageModel object
  *
  * @param array
  */
 public function __construct($args = array())
 {
     $args = array_merge(array('depth' => 'page', 'instance' => null), $args);
     $this->depth = $args['depth'];
     $this->compareInstance = $args['instance'];
     if (!isset(self::$modelTable)) {
         self::$modelTable = QFrame_Db_Table::getTable('model');
     }
     if (!isset(self::$modelResponseTable)) {
         self::$modelResponseTable = QFrame_Db_Table::getTable('model_response');
     }
     if (!isset(self::$sectionTable)) {
         self::$sectionTable = QFrame_Db_Table::getTable('section');
     }
     if (isset($args['modelID']) && isset($args['pageID'])) {
         $this->modelID = $args['modelID'];
         $this->page = new PageModel(array('pageID' => $args['pageID'], 'depth' => $args['depth']));
     } else {
         throw new InvalidArgumentException('Missing arguments to ModelPageModel constructor');
     }
     // To populate cache
     self::$modelResponseTable->fetchRows('modelID', $this->modelID, 'modelResponseID', $this->modelID);
     if ($this->depth !== 'page') {
         $this->_loadModelSections();
     }
 }