/** * @param Model $modelObject */ public function _setModel($modelObject) { if (!is_object($modelObject)) { $modelObject = new $modelObject(); } $this->_model = $modelObject; $this->_modelClass = get_class($modelObject); $this->_structure = $modelObject->_getStructure(); $this->_tableName = $this->_structure->getTableName(); $this->_primaryKey = $this->_structure->getPrimaryKey(); }
public function __construct($data = array()) { $this->_name = get_called_class(); $this->_internalObjectHash = md5(time() . microtime(true)); $this->_structure = ModelStructure::getInstanceForModel($this->_name); $this->_tableName = $this->_structure->getTableName(); $this->_primaryKey = $this->_structure->getPrimaryKey(); $this->mergeWithData($data); $this->initializeDataProcessor(); $this->initializeAbilities(); $this->configure(); }