原则和级联fetch =“ EAGER”

时间:2018-12-03 12:37:18

标签: mysql symfony doctrine-orm doctrine

我有三个实体:User> UserVersion> Color。每个实体都与fetch="EAGER"相关。

User类:

class User
{
    /**
     * @var UserVersion[]|ArrayCollection
     *
     * @ORM\OneToMany(
     *     targetEntity="App\Entity\UserVersion",
     *     mappedBy="user",
     *     cascade={"persist"},
     *     fetch="EAGER",
     * )
     */
    protected $versions;

UserVersion类:

class UserVersion
{
    /**
     * @var Color
     *
     * @ORM\ManyToOne(
     *     targetEntity="App\Entity\Color",
     *     fetch="EAGER",
     * )
     */
    private $color;

但是当我获得$entityManager->getRepository(User::class)->find(2)的用户时,我有一个加入User> UserVersion的联接,但不是 UserVersion> Color

我想加入我的三个实体。有可能还是我必须做$this->createQueryBuilder()并手动加入?

0 个答案:

没有答案