/** * 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); }
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); }
public static function statuses($value = null) { $options = [static::STATUS_INACTIVE => 'Inactive', static::STATUS_ACTIVE => 'Active']; return parent::enum($value, $options); }
/** * 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); }