[DC-312] Doctrine_Pager query "influences" Doctrine::getTable() query Created: 02/Dec/09  Updated: 02/Dec/09

Status: Open
Project: Doctrine 1
Component/s: Pager
Affects Version/s: 1.2.0
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Jan Matousek Assignee: Guilherme Blanco
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Debian testing squeeze 32 bit.



 Description   

When I use the same procedure without Doctrine_Pager everything works fine, with Doctrine_Pager the behavior of later queries is strange. Example:
----------------WORKING:
1. I fetch list
Doctrine_Query::create()>select('z.,s.,o.*,u.jmeno as Vložil,k.nazev_cs as Kategorie')>from('ShopZbozi z,z.Obrazek o,z.Soubor s,z.Uzivatel u,z.ShopKategorie k')>orderby('z.nazev_cs ASC')>fetchArray();

2. I fetch a row to edit independently on the list above
$object = Doctrine::getTable('ShopZbozi')->find(123);

3. edit properties of the object...

4. $object->replace();
the object is fetched with no related objects like [Uzivatel] or [Soubor], so when I change for example $object->iduzivatel (related Uzivatel object id) and save it is OK

----------------BROKEN:
1. I fetch list in Pager
new Doctrine_Pager(Doctrine_Query::create()>select('z.,s.,o.*,u.jmeno as Vložil,k.nazev_cs as Kategorie')>from('ShopZbozi z,z.Obrazek o,z.Soubor s,z.Uzivatel u,z.ShopKategorie k')>orderby('z.nazev_cs ASC'),$this>page,$this->perpage);

2. I fetch a row to edit independently on the list above (in contrast to the first working example this $object is fetched with EMPTY RELATION OBJECTS, which causes inserting empty new rows when calling ->replace())
$object = Doctrine::getTable('ShopZbozi')->find(123);

3. edit properties of the object...

4. $object->replace();
-> the $object has all the related object fetched as it was defined in the list in Pager - like it was used as a template for getTable and when ->replace() - new empty related objects are inserted in DB.

I've been using Doctrine for I guess 2 years now and I believe this bug/strange behavior has always been there.
Maybe I'm wrong and it is not a bug, but the behavior is strange and it took me really long to find where the problem is and I still don't know how to use pager without influencing the later queries.
Thanx John Mathew


Generated at Tue Jul 29 00:37:46 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.