EXTRA_LAZY can't make it.
You can try with partial object syntax
(see
http://docs.doctrine-project.org/en/2.1/reference/dql-doctrine-query-language.html).
Il giorno domenica 17 novembre 2013 14:24:00 UTC+1, Thomas Baumann ha
scritto:
>
> Hi there,
>
> I am not sure if fetch mode "EXTRA_LAZY" is what I need. Basically what I
> need is an array of Ids from a self referencing one to many association,
> without fetching all entities from the database.
>
> My Entity looks like this:
>
> Entity {
> /**
> * @ORM\ManyToOne(targetEntity="Entity", inversedBy="copiedEntities",
> cascade={"persist", "merge"}, fetch="LAZY")
> * @ORM\JoinColumn(name="original_entity_id",
> referencedColumnName="id")
> */
> var originalEntity;
>
> /**
> * @ORM\OneToMany(targetEntity="Entity", mappedBy="originalEntity",
> indexBy="id", cascade={"persist", "merge"}, fetch="EXTRA_LAZY")
> */
> var copiedEntities
> }
>
> Now, I would expect that only queries to retrieve the IDs are fired. This
> is true for originalEntity, as the ID has already been retrieved. No
> additional query is fired, but when I check the SQL-logs for
> copiedEntities, all entities are read from the database, not only the IDs.
> Expectation was, that a query is fired to retrieve the IDs from the Entity
> table. It becomes even worse, as the querying is repeated, if a copied
> entity has been copied again. This is going to become a serious performance
> issue, I can imagine.
>
> I am probably wrong with fetch mode "EXTRA_LAZY", but please point me to
> something, that achieves not to load the entities from an association.
> Maybe some misconfiguration done here? I only need the IDs, nothing else.
>
> Any chance to do that?
>
> Thanks folks,
> Thomas
>
--
You received this message because you are subscribed to the Google Groups
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/groups/opt_out.