protected function assignRelations($relations)
    {
        foreach ($relations as $relation) {
            if (!$relation instanceof RelationInterface) {
                throw new ModelException(sprintf('Relation must be an instance of RelationInterface, got "%s"', $this->getType($relation)));
            }

            foreach (array_keys($relation->keys()) as $field) {
                $this->assertField($field);
            }

            $this->relations[$relation->name()] = $relation;
        }
    }
protected function assignRelations($relations)
    {
        foreach ($relations as $relation) {
            if (!$relation instanceof RelationInterface) {
                throw new ModelException(sprintf('Relation must be an instance of RelationInterface, got "%s"', $this->getType($relation)));
            }

            foreach (array_keys($relation->keys()) as $field) {
                $this->assertField($field);
            }

            $this->relations[$relation->name()] = $relation;
        }
    }
protected function assignRelations ( $ relations ) { foreach ( $ relations as $ relation ) { if ( ! $ relation instanceof RelationInterface ) { throw new ModelException ( sprintf ( 'Relation must be an instance of RelationInterface, got "%s"' , $ this -> getType ( $ relation ) ) ) ; } foreach ( array_keys ( $ relation -> keys ( ) ) as $ field ) { $ this -> assertField ( $ field ) ; } $ this -> relations [ $ relation -> name ( ) ] = $ relation ; } }
Assigns relations to model

@param array $relations

@throws ModelException
Assigns relations to model