public function executeWithRestriction() { $this->assertInstanceOf(SelectQuery::class, (new SelectQuery())->withRestriction(Job::column('job_id')->equal(5))); }
function restrictionTest() { $this->assertSQL('where job_id = ceil(asin(sin(0.125)))', 'where job_id = ceiling(asin(sin(0.125)))', 'where job_id = ceil(asin(sin(0.125)))', 'where job_id = php(\'ceil\', php(\'asin\', php(\'sin\', 0.125)))', (new Criteria())->add(Restrictions::equal('job_id', SQLFunctions::ceil(SQLFunctions::asin(SQLFunctions::sin(0.125)))))); $this->assertSQL('where job_id = ceil(asin(sin(0.125)))', 'where job_id = ceiling(asin(sin(0.125)))', 'where job_id = ceil(asin(sin(0.125)))', 'where job_id = php(\'ceil\', php(\'asin\', php(\'sin\', 0.125)))', (new Criteria())->add(Restrictions::equal(Job::column('job_id'), SQLFunctions::ceil(SQLFunctions::asin(SQLFunctions::sin(0.125)))))); }
public function testJoinWithProjection() { $jp = new \rdbms\join\JoinProcessor(Job::getPeer()); $jp->setFetchModes(['PersonJob->Department' => 'join']); $jp->enterJoinContext(); try { $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', (new Criteria())->setFetchmode(\rdbms\join\Fetchmode::join('PersonJob'))->setProjection(\rdbms\criterion\Projections::projectionList()->add(Job::column('PersonJob->job_id'))->add(Job::column('PersonJob->Department->department_id')))->getSelectQueryString($this->conn, $this->peer, $jp)); } finally { $jp->leaveJoinContext(); } }
public function nonExistantRelative() { Job::column('NonExistant->person_id'); }
function withProjectionTest() { $crit = new Criteria(); $this->assertInstanceOf('rdbms.Criteria', $crit->withProjection(Projections::property(Job::column('job_id')))); $this->assertFalse($crit->isProjection()); $this->assertTrue($crit->withProjection(Projections::property(Job::column('job_id')))->isProjection()); }