php - Symfony 1.4 Propel Join Criteria needs peer constants -


i want share quite annoying you, because problem cost me lot of time understand:

lets start quite simple:

$c = new criteria(); $c->add(personpeer::id, 123); personpeer::doselect($c);  $c = new criteria(); $c->add("person.id", 123); personpeer::doselect($c); 

of course, both works because personpeer::id representation of string "person.id".

now join:

$c = new criteria(); $c->add(personpeer::id, 123); $c->addjoin(personpeer::id, orderpeer::person_id, criteria::left_join); $c->add(orderpeer::amount, 10); personpeer::doselect($c); 

quite simple, works... replace constants:

$c = new criteria(); $c->add(personpeer::id, 123); $c->addjoin("person.id", orderpeer::person_id, criteria::left_join); $c->add("order.amount", 10); personpeer::doselect($c); 

... still works. replace constants:

$c = new criteria(); $c->add("person.id", 123); $c->addjoin("person.id", "order.person_id", criteria::left_join); $c->add("order.amount", 10); fbpersonpeer::doselect($c); 

surprise surprise, throws propelexception:

wrapped: cannot fetch tablemap undefined table: order 

so why hell that? criterias exact same, doesn't work!

the solution: seems symfony hasn't loaded orderpeer!? here comes funny "bugfix":

orderpeer::amount; $c = new criteria(); $c->add("person.id", 123); $c->addjoin("person.id", "order.person_id", criteria::left_join); $c->add("order.amount", 10); fbpersonpeer::doselect($c); 

just call of orderpeer , works again.

pretty freaky, isn't it? it's not bug, it's feature?! :d

does has better solution or explanation!? symfony 1.4 or propel problem?


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -