second-level-cache, entity-hydrator throws exception #5119

Closed
opened 2026-01-22 14:58:53 +01:00 by admin · 9 comments
Owner

Originally created by @floriansemm on GitHub (May 4, 2016).

Originally assigned to: @Ocramius on GitHub.

I have the following entity:

/**
 * Geoinformation
 *
 * @ORM\Table(...)
 * @ORM\Entity(...)
 * @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="geoinformation_region")
 */
class Geoinformation
{
    // more properties

    /**
     * @var GeoinformationMetaData
     *
     * @ORM\OneToOne(targetEntity="AppBundle\Entity\GeoinformationMetaData", inversedBy="geoinformation", cascade={"persist"})
     * @ORM\JoinColumn(name="geoinformation_meta_data_id", referencedColumnName="id")
     * @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="geoinformation_region")
     */
    private $metaData;
}

Creating and persisting of new GeoinformationMetaData objects works fine. When I query the database I get the following error:

Uncaught PHP Exception Symfony\Component\Debug\Exception\ContextErrorException: "Notice: Undefined index: targetToSourceKeyColumns" at /project/vendor/doctrine/orm/lib/Doctrine/ORM/Cache/DefaultEntityHydrator.php line 106 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\ContextErrorException(code: 0): Notice: Undefined index: targetToSourceKeyColumns at /project/vendor/doctrine/orm/lib/Doctrine/ORM/Cache/DefaultEntityHydrator.php:106

I use doctrine v2.5.4 with symfony v3.0.5.

Originally created by @floriansemm on GitHub (May 4, 2016). Originally assigned to: @Ocramius on GitHub. I have the following entity: ``` php /** * Geoinformation * * @ORM\Table(...) * @ORM\Entity(...) * @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="geoinformation_region") */ class Geoinformation { // more properties /** * @var GeoinformationMetaData * * @ORM\OneToOne(targetEntity="AppBundle\Entity\GeoinformationMetaData", inversedBy="geoinformation", cascade={"persist"}) * @ORM\JoinColumn(name="geoinformation_meta_data_id", referencedColumnName="id") * @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="geoinformation_region") */ private $metaData; } ``` Creating and persisting of new `GeoinformationMetaData` objects works fine. When I query the database I get the following error: ``` Uncaught PHP Exception Symfony\Component\Debug\Exception\ContextErrorException: "Notice: Undefined index: targetToSourceKeyColumns" at /project/vendor/doctrine/orm/lib/Doctrine/ORM/Cache/DefaultEntityHydrator.php line 106 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\ContextErrorException(code: 0): Notice: Undefined index: targetToSourceKeyColumns at /project/vendor/doctrine/orm/lib/Doctrine/ORM/Cache/DefaultEntityHydrator.php:106 ``` I use doctrine `v2.5.4` with symfony `v3.0.5`.
admin added the BugDuplicate labels 2026-01-22 14:58:53 +01:00
admin closed this issue 2026-01-22 14:58:54 +01:00
Author
Owner

@okwinza commented on GitHub (Jun 24, 2016):

same thing with enabled second level cache, sf 2.8.7, doctrine 2.5.4

Any ideas?

@okwinza commented on GitHub (Jun 24, 2016): same thing with enabled second level cache, sf 2.8.7, doctrine 2.5.4 Any ideas?
Author
Owner

@Ocramius commented on GitHub (Jun 24, 2016):

Does this also affect master?
On Jun 24, 2016 04:19, "Oleg Krasavin" notifications@github.com wrote:

same thing with enabled second level cache, sf 2.8.7, doctrine 2.5.4

Any ideas?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/doctrine/doctrine2/issues/5808#issuecomment-228240242,
or mute the thread
https://github.com/notifications/unsubscribe/AAJakK8PAq-MLS0k0KHCJ6Wx9cj0XMmuks5qOz6igaJpZM4IW-VO
.

@Ocramius commented on GitHub (Jun 24, 2016): Does this also affect master? On Jun 24, 2016 04:19, "Oleg Krasavin" notifications@github.com wrote: > same thing with enabled second level cache, sf 2.8.7, doctrine 2.5.4 > > Any ideas? > > — > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub > https://github.com/doctrine/doctrine2/issues/5808#issuecomment-228240242, > or mute the thread > https://github.com/notifications/unsubscribe/AAJakK8PAq-MLS0k0KHCJ6Wx9cj0XMmuks5qOz6igaJpZM4IW-VO > .
Author
Owner

@okwinza commented on GitHub (Jun 24, 2016):

Master seems fine.

@okwinza commented on GitHub (Jun 24, 2016): Master seems fine.
Author
Owner

@Ocramius commented on GitHub (Jul 12, 2016):

Can anyone verify what commit fixes this issue, and link it up with what this issue duplicates?

@Ocramius commented on GitHub (Jul 12, 2016): Can anyone verify what commit fixes this issue, and link it up with what this issue duplicates?
Author
Owner

@yceruto commented on GitHub (Jul 12, 2016):

@floriansemm, @okwinza the "Association cache definition" documentation has a note:

Note: for this to work, the target entity must also be marked as cacheable.

Please, you could to check if this error still occurs adding @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="geoinformation_region") to AppBundle\Entity\GeoinformationMetaData target entity ??

@yceruto commented on GitHub (Jul 12, 2016): @floriansemm, @okwinza the ["Association cache definition"](http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/second-level-cache.html#association-cache-definition) documentation has a note: > Note: for this to work, the target entity must also be marked as cacheable. Please, you could to check if this error still occurs adding `@ORM\Cache(usage="NONSTRICT_READ_WRITE", region="geoinformation_region")` to `AppBundle\Entity\GeoinformationMetaData` target entity ??
Author
Owner

@Majkl578 commented on GitHub (Jul 12, 2016):

Repro test case here: https://gist.github.com/Majkl578/61731254ea9d36f2f32778d357ff4f5b
Bisected fix to commit e64f44ec9b (doesn't apply cleanly to 2.5.4 though) which refers to https://github.com/doctrine/doctrine2/pull/1555.

@Majkl578 commented on GitHub (Jul 12, 2016): Repro test case here: https://gist.github.com/Majkl578/61731254ea9d36f2f32778d357ff4f5b Bisected fix to commit e64f44ec9be28445eb340b9870f4b431baf554de (doesn't apply cleanly to 2.5.4 though) which refers to https://github.com/doctrine/doctrine2/pull/1555.
Author
Owner

@floriansemm commented on GitHub (Jul 14, 2016):

@yceruto the error was caused by an other relation. Everything is fine now.

@floriansemm commented on GitHub (Jul 14, 2016): @yceruto the error was caused by an other relation. Everything is fine now.
Author
Owner

@lcobucci commented on GitHub (Sep 19, 2016):

@yceruto the error was caused by an other relation. Everything is fine now.

Does it means that this issue can be closed?

@lcobucci commented on GitHub (Sep 19, 2016): > @yceruto the error was caused by an other relation. Everything is fine now. Does it means that this issue can be closed?
Author
Owner

@Ocramius commented on GitHub (Feb 7, 2017):

Closing as duplicate of #6124 unless anybody can create a different failing test scenario (in such case, I'll re-open).

@Ocramius commented on GitHub (Feb 7, 2017): Closing as duplicate of #6124 unless anybody can create a different failing test scenario (in such case, I'll re-open).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5119