public function restrictionsFactory()
 {
     $job_id = Job::column('job_id');
     $c = new Criteria(Restrictions::anyOf(Restrictions::not($job_id->in(array(1, 2, 3))), Restrictions::allOf(Job::column('title')->like('Hello%'), Job::column('valid_from')->greaterThan(new \util\Date('2006-01-01'))), Restrictions::allOf(Restrictions::like('title', 'Hello%'), Restrictions::greaterThan('valid_from', new \util\Date('2006-01-01'))), $job_id->between(1, 5)));
     $this->assertSql('where (not (job_id in (1, 2, 3))' . ' or (title like "Hello%" and valid_from > "2006-01-01 12:00AM")' . ' or (title like "Hello%" and valid_from > "2006-01-01 12:00AM")' . ' or job_id between 1 and 5)', $c);
 }
 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)))', create(new \rdbms\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)))', create(new \rdbms\Criteria())->add(Restrictions::equal(Job::column('job_id'), SQLFunctions::ceil(SQLFunctions::asin(SQLFunctions::sin(0.125))))));
 }
Exemple #3
0
 /**
  * Apply a "between" constraint to this property
  *
  * @param   var lo
  * @param   var hi
  * @return  rdbms.criterion.SimpleExpression
  */
 public function between($lo, $hi)
 {
     return Restrictions::between($this, $lo, $hi);
 }