当前位置: 首页>>代码示例>>PHP>>正文


PHP Expression::mul方法代码示例

本文整理汇总了PHP中Expression::mul方法的典型用法代码示例。如果您正苦于以下问题:PHP Expression::mul方法的具体用法?PHP Expression::mul怎么用?PHP Expression::mul使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Expression的用法示例。


在下文中一共展示了Expression::mul方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testFormCalculation

 public function testFormCalculation()
 {
     $form = Form::create()->add(Primitive::string('a'))->add(Primitive::boolean('b'))->add(Primitive::integer('c'))->add(Primitive::integer('d'))->add(Primitive::integer('e'))->add(Primitive::boolean('f'))->import(array('a' => 'asDfg', 'b' => 'true', 'c' => '1', 'd' => '2', 'e' => '3'));
     $this->assertTrue(Expression::isTrue(new FormField('b'))->toBoolean($form));
     $this->assertFalse(Expression::isTrue(new FormField('f'))->toBoolean($form));
     $this->assertFalse(Expression::eq('asdf', new FormField('a'))->toBoolean($form));
     $this->assertTrue(Expression::eqLower('asdfg', new FormField('a'))->toBoolean($form));
     $this->assertTrue(Expression::eq('asDfg', new FormField('a'))->toBoolean($form));
     $this->assertTrue(Expression::andBlock(Expression::expOr(new FormField('b'), new FormField('f')), Expression::eq(7, Expression::add(new FormField('c'), Expression::mul(new FormField('d'), new FormField('e')))))->toBoolean($form));
     $this->assertTrue(Expression::between(new FormField('d'), new FormField('c'), new FormField('e'))->toBoolean($form));
     $this->assertFalse(Expression::between(new FormField('c'), new FormField('d'), new FormField('e'))->toBoolean($form));
     $this->assertFalse(Expression::not(new FormField('b'))->toBoolean($form));
     $this->assertTrue(Expression::not(new FormField('f'))->toBoolean($form));
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:14,代码来源:LogicTest.class.php

示例2: toSelectQuery

 public function toSelectQuery()
 {
     if (!$this->range || !$this->interval) {
         throw new WrongStateException('define time range and interval units first');
     }
     if (!$this->range->getStart() || !$this->range->getEnd()) {
         throw new WrongArgumentException('cannot operate with unlimited range');
     }
     $firstIntervalStart = $this->interval->truncate($this->range->getStart(), !$this->overlapped);
     $maxIntervals = $this->interval->countInRange($this->range, $this->overlapped) - 1;
     $generator = $this->getSeriesGenerator(0, $maxIntervals);
     $result = OSQL::select()->from($generator, self::ITERATOR_ALIAS)->get(Expression::add(DBValue::create($firstIntervalStart->toString())->castTo(DataType::create(DataType::TIMESTAMP)->getName()), Expression::mul(DBValue::create("1 {$this->interval->getName()}")->castTo(DataType::create(DataType::INTERVAL)->getName()), DBField::create(self::ITERATOR_ALIAS))), $this->field);
     return $result;
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:14,代码来源:TimeIntervalsGenerator.class.php

示例3: testWhere

 public function testWhere()
 {
     $userId = 1;
     $user = TestUser::create()->setId($userId);
     $this->assertCriteria('from TestUser where id = $1 or id = $2 or $2 = id or $1 = $2', Criteria::create(TestUser::dao())->add(Expression::expOr(Expression::expOr(Expression::expOr(Expression::eqId('id', $user), Expression::eq('id', $userId)), Expression::eq($userId, 'id')), Expression::eq($userId, $userId))), array(1 => $user, 2 => $userId))->assertCriteria('from TestUser where id = 1 or id >= 1 or id <= 1 or id <> 1 or id != 1', Criteria::create(TestUser::dao())->add(Expression::expOr(Expression::expOr(Expression::expOr(Expression::expOr(Expression::eq('id', 1), Expression::gtEq('id', 1)), Expression::ltEq('id', 1)), Expression::notEq('id', 1)), Expression::notEq('id', 1))))->assertCriteria('from TestUser where id = 1 and Name = "some" ' . 'or Name = "any" or id = 1 > 2 = id * 2 + 1', Criteria::create(TestUser::dao())->add(Expression::expOr(Expression::expOr(Expression::expAnd(Expression::eq('id', 1), Expression::eq('Name', 'some')), Expression::eq('Name', 'any')), Expression::gt(Expression::eq('id', 1), Expression::eq(2, Expression::add(Expression::mul('id', 2), 1))))))->assertCriteria('from TestUser where (id = 1 and (Name = "some" or Name = "any"))', Criteria::create(TestUser::dao())->add(Expression::expAnd(Expression::eq('id', 1), Expression::expOr(Expression::eq('Name', 'some'), Expression::eq('Name', 'any')))))->assertCriteria('from TestUser where ((Name = "some" or Name = "any")) and (id = 1)', Criteria::create(TestUser::dao())->add(Expression::expAnd(Expression::expOr(Expression::eq('Name', 'some'), Expression::eq('Name', 'any')), Expression::eq('id', 1))))->assertCriteria('from TestUser where (id = 1) != ((1 = id) = (id >= 2))', Criteria::create(TestUser::dao())->add(Expression::notEq(Expression::eq('id', 1), Expression::eq(Expression::eq(1, 'id'), Expression::gtEq('id', 2)))))->assertCriteria('from TestUser where not (not not id = 1 and not id > 1)', Criteria::create(TestUser::dao())->add(Expression::not(Expression::expAnd(Expression::not(Expression::not(Expression::eq('id', 1))), Expression::not(Expression::gt('id', 1))))))->assertCriteria('from TestUser where id is null or id is not null or id is true or id is false', Criteria::create(TestUser::dao())->add(Expression::expOr(Expression::expOr(Expression::expOr(Expression::isNull('id'), Expression::notNull('id')), Expression::isTrue('id')), Expression::isFalse('id'))))->assertCriteria('from TestUser where id in (1) or id not in (1, "2", $1, true)', Criteria::create(TestUser::dao())->add(Expression::expOr(Expression::in('id', array(1)), Expression::notIn('id', array(1, '2', true, true)))), array(1 => true))->assertCriteria('from TestUser where id in ($1)', Criteria::create(TestUser::dao())->add(Expression::in('id', Criteria::create(TestUser::dao())->setProjection(Projection::property('id')))), array(1 => OQL::select('id from TestUser')->toCriteria()))->assertCriteria('from TestUser where id in ($1)', Criteria::create(TestUser::dao())->add(Expression::in('id', array(1, 2))), array(1 => array(1, 2)))->assertCriteria('from TestUser where id like $1 or id not like "Ы%" ' . 'or id ilike $2 or id not ilike "ы%" ' . 'or Name similar to "s" or Name not similar to $3', Criteria::create(TestUser::dao())->add(Expression::expOr(Expression::expOr(Expression::expOr(Expression::expOr(Expression::expOr(Expression::like('id', 'ы'), Expression::notLike('id', 'Ы%')), Expression::ilike('id', 'Ы')), Expression::notIlike('id', 'ы%')), Expression::similar('Name', 's')), Expression::notSimilar('Name', 'S'))), array(1 => 'ы', 2 => 'Ы', 3 => 'S'))->assertCriteria('from TestUser where created between "2008-08-06 10:00" and $1 ' . 'or id between id and 10', Criteria::create(TestUser::dao())->add(Expression::expOr(Expression::between('created', '2008-08-06 10:00', SQLFunction::create('now')), Expression::between('id', 'id', 10))), array(1 => SQLFunction::create('now')))->assertCriteria('from TestUser where (2 + -id --1) / 2 = id', Criteria::create(TestUser::dao())->add(Expression::eq(Expression::div(Expression::sub(Expression::add(2, Expression::minus('id')), -1), 2), 'id')), array(1 => 'id'));
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:6,代码来源:OqlSelectTest.class.php


注:本文中的Expression::mul方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。