RC1 Fixes

4 views
Skip to first unread message

Luís Otávio

unread,
Dec 16, 2009, 2:58:33 PM12/16/09
to outle...@googlegroups.com
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));

That's all folks...

I hope it helps...

Luís

alvaro

unread,
Dec 16, 2009, 4:43:47 PM12/16/09
to Outlet ORM
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));*

Fabio R.

unread,
Dec 21, 2009, 6:56:20 PM12/21/09
to outle...@googlegroups.com
Hi Luis,

We've fixed the first bug and another one reported here that might be related to your second one:
http://groups.google.com/group/outlet-orm/browse_thread/thread/edce030aa444befa

Just grab the latest version from trunk:
svn://knowledgehead.com/outlet/outlet-orm/trunk

Would you be able to test it and see if things are running fine? Would be nice to have a feedback before releasing 1.0rc2.


Thanks,
--
Fábio Rehm


--

You received this message because you are subscribed to the Google Groups "Outlet ORM" group.
To post to this group, send email to outle...@googlegroups.com.
To unsubscribe from this group, send email to outlet-orm+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/outlet-orm?hl=en.



Luís Otávio

unread,
Dec 21, 2009, 9:18:21 PM12/21/09
to outle...@googlegroups.com
Hi Fábio, sure I can test.
 
I'll get from the SVN this week and see if it's running fine!
 
Luís

Luís Otávio

unread,
Dec 22, 2009, 7:19:45 AM12/22/09
to outle...@googlegroups.com
Hello there,

I found another bug heheh

It happens when using one-to-one relation and gettersAndSetters.

The OutletMapper is accessing directly the attribute in line 383 (OutletMapper::saveOneToOne() method), the fix is just change from $obj->$key = $ent->$refKey; to $foreignEntityCfg = $this->config->getEntityForObject($ent); $entityCfg->setProp($obj, $key, $foreignEntityCfg->getProp($ent, $refKey));

I'm testing the trunk and I'll report later..

If you are interested I may join the developers team and help even more quickly...

Luís

Fabio R.

unread,
Dec 23, 2009, 12:20:14 AM12/23/09
to outle...@googlegroups.com
Code fixed on trunk :-)
Thanks for the patch.

--
Fábio Rehm
Reply all
Reply to author
Forward
0 new messages