/** * Instantiate a new ModelSectionModel object * * @param array */ public function __construct($args = array()) { $args = array_merge(array('depth' => 'section', '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::$questionTable)) { self::$questionTable = QFrame_Db_Table::getTable('question'); } if (isset($args['modelID']) && isset($args['sectionID'])) { $this->modelID = $args['modelID']; $this->section = new SectionModel(array('sectionID' => $args['sectionID'], 'depth' => $args['depth'])); } else { throw new InvalidArgumentException('Missing arguments to ModelSectionModel constructor'); } if ($this->depth !== 'section') { $this->_loadModelQuestions(); } }