Self join criteria in symfony
For Example : SELECT tbl1.id FROM tbl1 a LEFT JOIN tbl1 b ON a.somecolumnname = b.somecolumn ORDER BY a.somecolumn DESC The criteria would be as follow $c=new Criteria(); $c->addAlias(‘a’, ‘tbl1’);…
For Example : SELECT tbl1.id FROM tbl1 a LEFT JOIN tbl1 b ON a.somecolumnname = b.somecolumn ORDER BY a.somecolumn DESC The criteria would be as follow $c=new Criteria(); $c->addAlias(‘a’, ‘tbl1’);…
$markers = $this->Post->find(‘all’, array( ‘joins’ => array( array( ‘table’ => ‘cp_user’, ‘alias’ => ‘users’, ‘type’ => ‘left’, ‘foreignKey’ => false, ‘conditions’=> array(‘Post.postauthor = users.id’) ) ), ‘conditions’=>’Post.poststatus = 1’, ‘fields’=>array(‘Post.postid’,…