admin管理员组文章数量:1317898
I have the following table definition for Doctrine ORM:
<entity name="My\Namespace\User" table="users" >
//some fields here, not important
<many-to-one field="duplicateOf" target-entity="My\Namespace\User" fetch="EXTRA_LAZY">
<join-column name="duplicate_of" referenced-column-name="id" />
</many-to-one>
</entity>
with it's corresponding entity:
class User
{
private int $id;
private ?User $duplicateOf = null;
}
As you can see, there is a duplicate_of
column, because there can be duplicate accounts in my case. And the entity can have objects of the same type as itself inside it.
Here's my question: If I do this:
$qb = $this->entityManager->getRepository(User::class)->createQueryBuilder('u');
$qb->where('u.duplicateOf IS NULL')
->orderBy('...');
//other logic, execute query etc.
In this case, will $duplicateOf
be populated by a User
object, even though I explicitly marked it as extra-lazy
? Can Doctrine perform the ...IS NULL
check without hydrating?
版权声明:本文标题:php - Will Doctrine ORM load the entity in WHERE clause even though it's marked as Extra Lazy? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742033643a2416921.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论