Приветики, может кто подскажет решение?
Дано:
Сущность
class Post {
/**
* @ORM\ManyToOne(targetEntity=Author::class)
* @ORM\JoinColumn(nullable=false)
*/
private $author;
}
Репозиторий
class PostRepository {
public function findByFilter() {
$criteria = \Doctrine\Common\Collections\Criteria::create();
$criteria->andWhere(
new \Doctrine\Common\Collections\Expr\Comparison(‘author_id’, ‘==’, 1)
);
return $this->matching($criteria)->getValues();
}
}
Проблема:
как дать понять Criteria что author_id=1 это author=Author(1) ?