Esempio n. 1
0
 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']);
 }
Esempio n. 2
0
 /**
  * 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;
 }
Esempio n. 3
0
 /**
  * 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;
 }