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

Adding Object on CrossReference is not adding backreference #677

Closed
danez opened this issue May 3, 2013 · 0 comments
Closed

Adding Object on CrossReference is not adding backreference #677

danez opened this issue May 3, 2013 · 0 comments

Comments

@danez
Copy link
Contributor

danez commented May 3, 2013

The following Test fails at the last assertCount, altough I think it should work as tested. But In the generated BaseObjects there is nowhere a backreference set. I tried doing so, but then ended up with endless loops.

   /**
    * @group mine
    */
    public function testManyToManyAddIsSettingAllReferences()
    {
        $list1 = new BookClubList();
        $list2 = new BookClubList();
        $book = new Book();

        $book->addBookClubList($list1);
        $book->addBookClubList($list2);

        $lists = $book->getBookClubLists();
        $this->assertCount(2, $lists, 'setRelCol is losing references to referenced object');

        $rels = $book->getBookListRels();
        $this->assertCount(2, $rels, 'setRelCol is losing references to relation object');

        foreach ($rels as $rel) {
            $this->assertNotNull($rel->getBook(), 'setRelCol is losing backreference on set relation to local object');
            $this->assertNotNull($rel->getBookClubList(), 'setRelCol is losing backreference on set relation to referenced object');
        }

        foreach ($lists as $list) {
            $this->assertCount(1, $list->getBooks(), 'setRelCol is losing backreference on set objects');
        }
    }
willdurand added a commit that referenced this issue May 6, 2013
Fix for issue #677: Set the back reference
@danez danez closed this as completed Jan 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant