vendredi 1 juillet 2016

Propel Code for Join over Columns from mulitple table


I have the below query that i am trying to convert to propel in php

select destinationdir.* from destinationdir
left join sourcedir on sourcedir.path = destinationdir.path 
where destinationdir.pullrequestid = '421603579'
and destinationdir.checksum <> sourcedir.checksum

I managed to write upto below code(not sure if its right)

$c = new Criteria(); $c->addJoin(DestinationdirTableMap::COL_PATH,SourcedirTableMap::COL_PATH,Criteria::LEFT_JOIN); $c->add(DestinationdirTableMap::COL_PULLREQUESTID,$pullrequestid,Criteria::EQUAL); $result = SourcedirQuery::create('Test', $c)->toString();

For the above i get

SELECT  FROM destinationdir LEFT JOIN sourcedir ON
(destinationdir.path=sourcedir.path) WHERE destinationdir.pullrequestid=:p1
Params: destinationdir.pullrequestid => 621440992

I dont understand how to add "destinationdir.checksum <> sourcedir.checksum" into the propel code.

Any help would be appreciated.


Aucun commentaire:

Enregistrer un commentaire