Bluz\Db\Row::getRelation PHP Method

getRelation() public method

Get relation by model name
public getRelation ( string $modelName ) : Row | false
$modelName string
return Row | false
    public function getRelation($modelName)
    {
        $relations = $this->getRelations($modelName);
        if (!empty($relations)) {
            return current($relations);
        } else {
            return false;
        }
    }

Usage Example

Example #1
0
 /**
  * @expectedException Bluz\Db\Exception\RelationNotFoundException
  */
 public function testGetRelationException()
 {
     $this->row->getRelation('wrongRelation');
 }