Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Doctrine2] var_export does not handle circular references after extractPrimaryKey under certain circumstances #5663

Closed
Basster opened this issue Aug 23, 2019 · 1 comment · Fixed by #5685

Comments

@Basster
Copy link
Contributor

commented Aug 23, 2019

What are you trying to achieve?

Hands down, I have a pretty complex Entity structure:


/** @Entity **/
class A {}

/** @Entity **/
class B {}

/** @Entity **/
class C{}

/** @Entity **/
class D {
    /**
     * @ORM\Id
     * @ORM\ManyToOne(targetEntity="A", inversedBy="as")
     */
    private $a;

    /**
     * @ORM\Id
     * @ORM\ManyToOne(targetEntity="B", inversedBy="bs")
     */
    private $b;

    /**
     * @ORM\Id
     * @ORM\ManyToOne(targetEntity="C", inversedBy="cs")
     */
    private $c;
}

All ManyToOne relations are bidirectional!

Now I try to (pretty simplified):

$a = new A();
$b = new B();
$c = new C();
$d = new D($a, $b, $c);

$I->haveInRepository($d, ['a' => $a, 'b' => $b, 'c' => $c]);

haveInRepository is working correctly, but the debug line right before the return utilizes a var_export to display the primary keys and fails with var_export does not handle circular references!

Details

  • Codeception version: 3.1.0
  • PHP Version: 7.3
  • Operating System: doesn't matter
  • Installation type: Composer
  • List of installed packages: doesn't matter
  • Suite configuration: doesn't matter
Basster added a commit to Basster/Codeception that referenced this issue Aug 23, 2019
… => $pk when composite ids are entities, as well.
@javabudd

This comment has been minimized.

Copy link

commented Sep 4, 2019

Can confirm, this is happening after updating to 3.1.0

Basster added a commit to Basster/Codeception that referenced this issue Sep 12, 2019
Basster added a commit to Basster/Codeception that referenced this issue Sep 12, 2019
Basster added a commit to Basster/Codeception that referenced this issue Sep 12, 2019
DavertMik added a commit that referenced this issue Sep 13, 2019
…ith composite keys of entities in bidirectional relations (#5685)

* #5663: build failing test

* #5663: fixed debugEntityCreation for entities with circular references.

* #5663: remove redundant "primary key " part from debug message.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.