Ouzo\Db\Relation::inline PHP Метод

inline() публичный статический Метод

public static inline ( array $params ) : Relation
$params array { @var string $class @var string $localKey @var string $foreignKey @var bool $collection @var string $destinationField }
Результат Relation
    public static function inline($params)
    {
        return RelationFactory::inline($params);
    }

Usage Example

Пример #1
0
 /**
  * @test
  */
 public function shouldJoinInlineRelation()
 {
     //given
     $product = Product::create(array('name' => 'sony'));
     $orderProduct = OrderProduct::create(array('id_product' => $product->getId()));
     //when
     $fetched = Product::join(Relation::inline(array('destinationField' => 'orderProduct', 'class' => 'Test\\OrderProduct', 'foreignKey' => 'id_product', 'localKey' => 'id')))->fetch();
     //then
     $this->assertEquals($orderProduct, self::getNoLazy($fetched, 'orderProduct'));
 }