public function testCastPropertiesObject() { $property = 123; $expectedProperty = (object) 123; $this->ormMock->expects($this->once())->method('getValue')->with('property')->will($this->returnValue($property)); $this->ormMock->expects($this->once())->method('setValue')->with('property', $expectedProperty); $this->model->castPropertiesObject(['property']); }
/** * Sort in descending order * * @param array $fields * @return $this */ public function sortDescending($fields = []) { if (!is_array($fields)) { $fields = [$fields]; } foreach ($fields as $field) { $this->dataSource->orderByDesc($field); } return $this; }
/** * Get model orm * * @return Db\Common\Orm */ public static function orm() { $db = \Magelight\App::getInstance()->db(static::callStaticLate('getDbIndex')); $ormClass = \Magelight\Db\Common\Orm::getOrmClassByType($db->getType()); $orm = call_user_func_array([$ormClass, 'forge'], [$db]); /* @var $orm \Magelight\Db\Mysql\Orm */ $orm->setIdColumn(static::callStaticLate('getIdField')); $orm->setTableName(static::callStaticLate('getTableName')); $orm->setModelName(static::getClassRedefinition()); return $orm; }