php - Issue with Doctrine 2 query and join statements -


trying query database using doctrine query builder (it's symfony2 form query builder has used).

getting following error:
sqlstate[42s22]: column not found: 1054 unknown column 'c2_.casefileid' in 'on clause'

my query follows:

$er->createquerybuilder('ia')      ->select( 'ia' )      ->from( 'thebundle:caseinstruction', 'ci' )      ->innerjoin( 'thebundle:casefile', 'cf', 'with', 'ci.casefile = cf' )      ->innerjoin( 'thebundle:workflow', 'wf', 'with', 'wf.product = ci.product , wf.company = cf.company' )      ->innerjoin( 'thebundle:workflowinstructionaction', 'wfia', 'with', 'wfia.instructionaction = ia , wfia.workflow = wf' )      ->innerjoin( 'thebundle:process', 'p', 'with', 'p.currentstatus = ci.status , p.workflow = wf' )      ->innerjoin( 'thebundle:processtrigger', 'pt', 'with', 'pt.instructionaction = ia , pt.process = pt' )      ->where( 'ci.id = :cid' )      ->andwhere( 'ia.issystemaction = :issystemaction' )      ->setparameter( 'issystemaction', '0' )      ->setparameter( 'cid', $options['caseinstructionid'] ); 

which evaluates following doctrine query (as shown in exception):

'select i0_.id id0,         i0_.codename codename1,         i0_.permissions permissions2,         i0_.description description3,         i0_.issystemaction issystemaction4,         i0_.instructionactivityid instructionactivityid5,         i0_.instructionsubjectid instructionsubjectid6   instructionaction i0_      inner join casefile c1_ on (c2_.casefileid = c1_.id)      inner join workflow w3_ on (w3_.productid = c2_.productid , w3_.companyid = c1_.companyid)       inner join workflowinstructionaction w4_ on (w4_.instructionactionid = i0_.id , w4_.workflowid = w3_.id)      inner join process p5_ on (p5_.currentstatusid = c2_.instructionstatusid , p5_.workflowid = w3_.id)       inner join processtrigger p6_ on (p6_.instructionactionid = i0_.id , p6_.processid = p6_.id), caseinstruction c2_   c2_.id = ?   , i0_.issystemaction = ?' params ["307", "0"] 

(tried make readable possible)

does have idea how fix error? have native sql version working, , trying translate doctrine query builder.

edit: working sql:

select ia.* (instructionaction ia, caseinstruction ci) join casefile cf on ci.casefileid=cf.id join workflow wf on ci.productid=wf.productid , wf.companyid = cf.companyid join workflowinstructionaction wia on wia.workflowid=wf.id , wia.instructionactionid = ia.id join process p on p.currentstatusid = ci.instructionstatusid , p.workflowid = wf.id join processtrigger pt on pt.instructionactionid = ia.id , pt.processid = p.id  ci.id = 275 , ia.issystemaction=0; 

caseinstruction id 275 example caseinstruction id - replaced $options['caseinstructionid'] in query builder.


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -