public static function build(Sabel_Db_Model $source, Sabel_Db_Join_Structure $structure, $rows) { $objects = $structure->getJoinObjects(); $structure = $structure->getStructure(); $tables = array(); foreach ($structure as $joinTables) { $tables = array_merge($tables, $joinTables); } $results = array(); $selfObj = MODEL($source->getName()); foreach ($rows as $row) { $models = self::createModels($row, $tables, $objects); foreach ($tables as $tblName) { if (!isset($structure[$tblName])) { continue; } foreach ($structure[$tblName] as $parent) { $name = convert_to_modelname($parent); $models[$tblName]->__set($name, $models[$parent]); } } $self = clone $selfObj; $self->setProperties($row); $tblName = $source->getTableName(); foreach ($structure[$tblName] as $parent) { $name = convert_to_modelname($parent); $self->__set($name, $models[$parent]); } $results[] = $self; } return $results; }
public function __construct(Sabel_Db_Model $model) { $this->model = $model; $this->mdlName = $model->getName(); $this->isUpdate = $model->isSelected(); $this->messages = Sabel_Db_Validate_Config::getMessages(); $this->localizedNames = Sabel_Db_Model_Localize::getColumnNames($this->mdlName); }