Closed Surt closed 11 years ago
A new change for Paris, related to the change in Idiorm. Using this intermediate function we can delete the "find_many" overload in paris. 1 loop less in each Paris call!!! it gives Paris much more speed. It creates the orm instance, and the model after it. In the same loop that Idiorm uses....
protected function _instances_with_key($rows){
$size = count($rows);
$instances = array();
for ($i = 0; $i < $size; $i++) {
$row = $this->_create_instance_from_row($rows[$i]);
$row = $this->_create_model_instance($row);
$key = (isset($row->{$this->_instance_id_column})) ? $row->{$this->_instance_id_column} : $i;
$instances[$key] = $row;
}
return $instances;
}
Thanks to the associative keys change, resultsets can use the keys to build, for example, a query to delete all, in just 1 query, or update... instead of call the function on each model.
Nice! I'd like to use this feature on my current project. Sorry if this is a little off-topic, but, when is the next point release expected?
@lrlopez It was going to be this week, but I am snowed under with a client project at the moment. I am still aiming to have 1.4 out in June though.
Merged in commits 022d328fcd8275, 39f4cc4c43b6ee, 42d8715e3bd20, 98a3f0b713ca
With this change, the find_many will return an array, or resultSet, with keys as the primary key.
array( '4' => 'aModelinstance'... '20' => 'anotherModelinstance'... );
It will save time for the eagerLoading functionality we are preparing for Paris.