Ouzo\Model::__construct PHP 메소드

__construct() 공개 메소드

Accepted parameters:
public __construct ( array $params )
$params array {
    public function __construct(array $params)
    {
        $this->_prepareParameters($params);
        $this->_modelDefinition = ModelDefinition::get(get_called_class(), $params);
        $primaryKeyName = $this->_modelDefinition->primaryKey;
        $attributes = $this->_modelDefinition->mergeWithDefaults($params['attributes'], $params['fields']);
        if (isset($attributes[$primaryKeyName]) && Strings::isBlank($attributes[$primaryKeyName])) {
            unset($attributes[$primaryKeyName]);
        }
        $this->_attributes = $this->filterAttributes($attributes);
        $this->_modifiedFields = array_keys($this->_attributes);
    }

Usage Example

예제 #1
0
파일: Hit.php 프로젝트: thuliumcc/dartboard
 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']]]);
 }
All Usage Examples Of Ouzo\Model::__construct