/** * Loads the data of the current element * * @return mixed */ public final function loadElementData() { $objAnnotations = new class_reflection($this); $arrTargetTables = $objAnnotations->getAnnotationValuesFromClass(class_orm_base::STR_ANNOTATION_TARGETTABLE); $strTargetTable = ""; if (count($arrTargetTables) != 0) { $arrCachedRow = class_orm_rowcache::getCachedInitRow($this->getSystemid()); if ($arrCachedRow !== null && !isset($arrCachedRow["content_id"])) { class_orm_rowcache::removeSingleRow($this->getSystemid()); } $objORM = new class_orm_objectinit($this); $objORM->initObjectFromDb(); $arrTables = explode(".", $arrTargetTables[0]); $strTargetTable = _dbprefix_ . $arrTables[0]; } else { if ($this->getArrModule("table") != "") { $strTargetTable = $this->getArrModule("table"); } } $objORM = new class_orm_objectlist(); //Element-Table given? if ($strTargetTable != "") { $strQuery = "SELECT *\n \t\t\t\t\t FROM " . $strTargetTable . ",\n \t\t\t\t\t \t " . _dbprefix_ . "element,\n \t\t\t\t\t \t " . _dbprefix_ . "page_element,\n \t\t\t\t\t \t " . _dbprefix_ . "system_right,\n \t\t\t\t\t \t " . _dbprefix_ . "system\n \t\t\t\t\t LEFT JOIN " . _dbprefix_ . "system_date\n \t\t\t\t\t ON (system_id = system_date_id)\n \t\t\t\t\t WHERE element_name = page_element_ph_element\n \t\t\t\t\t AND page_element_id = content_id\n \t\t\t\t\t AND system_id = right_id\n \t\t\t\t\t AND system_id = content_id\n \t\t\t\t\t " . $objORM->getDeletedWhereRestriction() . "\n \t\t\t\t\t AND system_id = ? "; } else { $strQuery = "SELECT *\n \t\t\t\t\t FROM " . _dbprefix_ . "element,\n \t\t\t\t\t \t " . _dbprefix_ . "page_element,\n \t\t\t\t\t \t " . _dbprefix_ . "system_right,\n \t\t\t\t\t \t " . _dbprefix_ . "system\n \t\t\t\t\t LEFT JOIN " . _dbprefix_ . "system_date\n \t\t\t\t\t ON (system_id = system_date_id)\n \t\t\t\t\t WHERE element_name = page_element_ph_element\n \t\t\t\t\t AND page_element_id = system_id\n \t\t\t\t\t AND system_id = right_id\n \t\t\t\t\t " . $objORM->getDeletedWhereRestriction() . "\n \t\t\t\t\t AND system_id = ? "; } $this->arrElementData = class_carrier::getInstance()->getObjDB()->getPRow($strQuery, array($this->getSystemid())); class_orm_rowcache::addSingleInitRow($this->arrElementData); return $this->arrElementData; }
/** * InitObjectInternal is called during an objects instantiation. * The default implementation tries to map all database-fields to the objects fields * and sets the values automatically. * * If you have a different column-property mapping or additional * setters to call, overwrite this method. * The row loaded from the database is available by calling $this->getArrInitRow(). * @return void */ protected function initObjectInternal() { $objORM = new class_orm_objectinit($this); $objORM->initObjectFromDb(); }