public function testJoinWithProjection() { $jp = new JoinProcessor(Job::getPeer()); $jp->setFetchModes(array('PersonJob->Department' => 'join')); $jp->enterJoinContext(); $this->assertEquals('select PersonJob.job_id, PersonJob_Department.department_id from JOBS.job as start, JOBS.Person as PersonJob, JOBS.Department as PersonJob_Department where start.job_id *= PersonJob.job_id and PersonJob.department_id *= PersonJob_Department.department_id and 1 = 1', create(new Criteria())->setFetchmode(Fetchmode::join('PersonJob'))->setProjection(Projections::ProjectionList()->add(Job::column('PersonJob->job_id'))->add(Job::column('PersonJob->Department->department_id')))->getSelectQueryString($this->conn, $this->peer, $jp)); $jp->leaveJoinContext(); }
/** * set the fetchmode for a path * * @param rdbms.join.Fetchmode fetchmode * @return rdbms.Criteria this object */ public function setFetchmode(Fetchmode $fetchmode) { $this->fetchmode[$fetchmode->getPath()] = $fetchmode->getMode(); return $this; }