Hi Luis,
Thanks for the fixes, i'll apply them tonight and they will be
released with 1.0rc2.
Alvaro
On Dec 16, 12:58 pm, Luís Otávio <
lcobu...@gmail.com> wrote:
> Hi all,
>
> I'm Luís from Brazil.
>
> My english is not so good, but I'll try...
>
> I've made some fixes in the framework that corrects this two situations
> below:
>
> *1*- When fetching the associated objects, like Project::getBugs() (found in
> the documentation pages), the OutletCollection::load() method is just called
> through the Iterator or calling the OutletCollection::toArray() method
> because it uses the lazy load, perfect. But...
>
> $project = $outlet->load('Project', 1);
> $bugs = $project->getBugs();
>
> I wanna get the first Bug in the collection, I don't want to iterate just
> the first..
> Well, the OutletCollection extends the Collection that extends the
> ArrayObject, so I can do:
>
> $bugs[0]->getId();
>
> But this don't work, the index 0 don't exists (where's the lazy load???).
>
> That's simple to correct, just override the ArrayObject::offsetGet() method
> in OutletCollection to call the OutletCollection::load() before the
> parent::offsetGet().
>
> *2*- When I have different column names in my tables, and I try to save a
> Project, for instance, after load all bugs and add a new Bug a PDOExceptions
> is throwed. The framework is trying to update the old bugs that have the
> same values in the database.
>
> The fix is simple too, the OutletEntityConfig::toRow() is using the object's
> atribute name and not the column name, it makes the array_diff_assoc()
> return wrong values.
>
> Just change the line 282 from *$arr[$key] = OutletMapper::toSqlValue($p[1],
> $this->getProp($entity, $key));* to *$arr[$p[0]] =
> OutletMapper::toSqlValue($p[1], $this->getProp($entity, $key));*