コード例 #1
0
 /**
  *
  * @param string $modelName Hopefully unique model name
  * @param string $modelField The name of the field used to store the sub model
  */
 public function __construct($modelName = 'fields_maintenance', $modelField = 'sub')
 {
     parent::__construct($modelName, $modelField);
     $modelF = new \MUtil_Model_TableModel('gems__respondent2track2field');
     \Gems_Model::setChangeFieldsByPrefix($modelF, 'gr2t2f');
     $this->addUnionModel($modelF, null, FieldMaintenanceModel::FIELDS_NAME);
     $modelA = new \MUtil_Model_TableModel('gems__respondent2track2appointment');
     \Gems_Model::setChangeFieldsByPrefix($modelA, 'gr2t2a');
     $mapBase = $modelA->getItemsOrdered();
     $map = array_combine($mapBase, str_replace('gr2t2a_', 'gr2t2f_', $mapBase));
     $map['gr2t2a_id_app_field'] = 'gr2t2f_id_field';
     $map['gr2t2a_id_appointment'] = 'gr2t2f_value';
     $this->addUnionModel($modelA, $map, FieldMaintenanceModel::APPOINTMENTS_NAME);
 }
コード例 #2
0
 /**
  * Returns an array containing the first requested item.
  *
  * @param mixed $filter True to use the stored filter, array to specify a different filteloa
  * @param mixed $sort True to use the stored sort, array to specify a different sort
  * @param boolean $loadDependencies When true the row dependencies are loaded
  * @return array An array or false
  */
 public function loadFirst($filter = true, $sort = true, $loadDependencies = true)
 {
     // Needed as the default order otherwise triggers the type dependency
     $oldDep = $this->_addLoadDependency;
     $this->_addLoadDependency = $loadDependencies;
     $output = parent::loadFirst($filter, $sort);
     $this->_addLoadDependency = $oldDep;
     return $output;
 }