Наследование: extends Cake\ORM\Entity
Пример #1
0
 /**
  * MyModelTest::testEnum()
  *
  * @return void
  */
 public function testEnum()
 {
     $array = [1 => 'foo', 2 => 'bar'];
     $res = Entity::enum(null, $array, false);
     $this->assertEquals($array, $res);
     $res = Entity::enum(2, $array, false);
     $this->assertEquals('bar', $res);
     $res = Entity::enum('2', $array, false);
     $this->assertEquals('bar', $res);
     $res = Entity::enum(3, $array, false);
     $this->assertFalse($res);
 }
Пример #2
0
 public static function statuses($value = null)
 {
     $options = [static::STATUS_ACTIVE => __d('tools', 'Active'), static::STATUS_PUBLISHED => __d('tools', 'Published'), static::STATUS_APPROVED => __d('tools', 'Approved'), static::STATUS_FLAGGED => __d('tools', 'Flagged')];
     return parent::enum($value, $options);
 }
Пример #3
0
 public static function statuses($value = null)
 {
     $options = [static::STATUS_INACTIVE => 'Inactive', static::STATUS_ACTIVE => 'Active'];
     return parent::enum($value, $options);
 }
Пример #4
0
 /**
  * Language::directions()
  *
  * @param mixed $value
  * @return mixed
  */
 public static function directions($value = null)
 {
     $options = [self::DIR_LTR => 'LTR', self::DIR_RTL => 'RTL'];
     return parent::enum($value, $options);
 }