Orm: second-level-cache, entity-hydrator throws exception

Created on 4 May 2016  Â·  9Comments  Â·  Source: doctrine/orm

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.

Bug Duplicate

Most helpful comment

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

All 9 comments

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

Any ideas?

Does this also affect master?
On Jun 24, 2016 04:19, "Oleg Krasavin" [email protected] 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
.

Master seems fine.

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

@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 ??

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.

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

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

Does it means that this issue can be closed?

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

doctrinebot picture doctrinebot  Â·  4Comments

Inmmelman picture Inmmelman  Â·  3Comments

delboy1978uk picture delboy1978uk  Â·  3Comments

doctrinebot picture doctrinebot  Â·  4Comments

strayobject picture strayobject  Â·  4Comments