private function selectModelColumns(Model $metaInstance, $alias) { if ($this->_selectModel) { $prefix = $this->aliasPrefixForSelect($alias); $this->_query->selectColumns = $this->_query->selectColumns + ColumnAliasHandler::createSelectColumnsWithAliases($prefix, $metaInstance->_getFields(), $alias); } }
public function matches($argument) { if (get_class($this->expected) !== get_class($argument)) { return false; } $actualAttributes = Arrays::filterByAllowedKeys($argument->attributes(), $this->expected->getFields()); return $this->expectedAttributes == $actualAttributes; }
private function _generatePredefinedAttributes($field) { $id = $this->_generateId($field); $attributes = array('id' => $id); if (in_array($field, $this->_object->getErrorFields())) { $attributes['class'] = 'error'; } return $attributes; }
public function validate() { parent::validate(); if (!$this->name) { parent::error('Empty name'); $this->_errorFields[] = 'name'; } }
public function __construct($attributes = array()) { parent::__construct(array('hasMany' => array('products' => array('class' => 'Test\\Product', 'foreignKey' => 'id_category'), 'products_starting_with_b' => array('class' => 'Test\\Product', 'foreignKey' => 'id_category', 'conditions' => "products.name LIKE 'b%'"), 'products_ending_with_b_or_y' => array('class' => 'Test\\Product', 'foreignKey' => 'id_category', 'conditions' => function () { return WhereClause::create("products.name LIKE ? OR products.name LIKE ?", array('%b', '%y')); }), 'products_name_bob' => array('class' => 'Test\\Product', 'foreignKey' => 'id_category', 'conditions' => array("products.name" => "bob")), 'products_ordered_by_name' => array('class' => 'Test\\Product', 'foreignKey' => 'id_category', 'order' => array("products.name ASC"))), 'hasOne' => array('product_named_billy' => array('class' => 'Test\\Product', 'foreignKey' => 'id_category', 'conditions' => "products.name = 'billy'")), 'belongsTo' => array('parent' => array('class' => 'Test\\Category', 'foreignKey' => 'id_parent', 'referencedColumn' => 'id')), 'attributes' => $attributes, 'fields' => $this->_fields)); }
public function __construct($attributes = array()) { parent::__construct(array('table' => 'products', 'attributes' => $attributes, 'fields' => array('description' => self::$defaultDescription, 'name' => function () { return ProductWithDefaults::$defaultName; }, 'id_category', 'id_manufacturer', 'sale'))); }
public function __construct($attributes = array()) { parent::__construct(array('table' => 'orders', 'sequence' => 'orders_id_order_seq', 'primaryKey' => 'id_order', 'attributes' => $attributes, 'fields' => $this->_fields)); }
public function __construct($attributes = array(), $beforeSaveCallback = null, $afterSaveCallback = null) { parent::__construct(array('beforeSave' => $beforeSaveCallback, 'afterSave' => $afterSaveCallback, 'table' => 'products', 'primaryKey' => 'id', 'attributes' => $attributes, 'fields' => array('name'))); }
public function __construct($attributes = []) { parent::__construct(['attributes' => $attributes, 'fields' => ['id', 'name', 'params', 'created_at' => Clock::nowAsString()]]); }
public function __construct($attributes = []) { parent::__construct(['attributes' => $attributes, 'fields' => ['id', 'game_user_id', 'field', 'multiplier', 'round'], 'belongsTo' => ['game_user' => ['class' => 'GameUser', 'foreignKey' => 'game_user_id', 'referencedColumn' => 'id']]]); }
public function __construct(array $params) { parent::__construct($params); }
private function _assertSamePersistentAttributes(Model $expected) { $expectedAttributes = Arrays::filterByAllowedKeys($expected->attributes(), $expected->getFields()); $actualAttributes = Arrays::filterByAllowedKeys($this->_actual->attributes(), $this->_actual->getFields()); AssertAdapter::assertEquals($expectedAttributes, $actualAttributes, 'Models have different attributes '); }
/** * @return bool */ public function delete() { $this->current_game_user_id = null; $this->winner_game_user_id = null; $this->update(); GameUser::where(['game_id' => $this->id])->deleteEach(); return parent::delete(); }
public function __construct($attributes = array()) { parent::__construct(array('table' => 'products', 'primaryKey' => '', 'attributes' => $attributes, 'fields' => $this->_fields)); }
/** * @test */ public function shouldThrowExceptionIfNoRelation() { $model = new Model(array('fields' => array('field1'))); //when try { $model->getRelation('invalid'); $this->fail(); } catch (InvalidArgumentException $e) { } }
public function __construct($attributes = array()) { parent::__construct(array('table' => 'order_products', 'sequence' => '', 'primaryKey' => '', 'attributes' => $attributes, 'belongsTo' => array('product' => array('class' => 'Test\\Product', 'foreignKey' => 'id_product'), 'order' => array('class' => 'Test\\Order', 'foreignKey' => 'id_order')), 'fields' => $this->_fields)); }
public function validate() { parent::validate(); $this->validateNotBlank($this->login, 'Login cannot be blank'); }
public function __construct($attributes = array()) { parent::__construct(array('table' => 'products', 'primaryKey' => 'id', 'fields' => array('name'), 'sequence' => '', 'attributes' => $attributes)); }
/** * @return bool */ public function delete() { Hit::where(['game_user_id' => $this->id])->deleteAll(); return parent::delete(); }
public static function getNoLazy(Model $model, $attribute) { return Arrays::getValue($model->attributes(), $attribute); }
public function __construct() { parent::__construct(array('fields' => array('name'))); }
public function __construct($attributes = array()) { parent::__construct(array('hasMany' => array('products' => array('class' => 'Test\\Product', 'foreignKey' => 'id_manufacturer')), 'attributes' => $attributes, 'fields' => $this->_fields)); }