Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2080

Entity's association changes after first call

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Trivial Trivial
    • Resolution: Invalid
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3, 2.3.1
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None

      Description

      i am using the latest version of doctrine: 2.3

      when you call a generated association function, the first time everything is fine:

      $authors = $book->getBookToAuthors();
      //$authors = array(5)
      but the second time instead of returning the array of all associations it returns the last hydrated entity:

      $authors = $book->getBookToAuthors();
      //$authors = BookToAuthor entity
      that happens even when there is nothing else happening:

      $authors = $book->getBookToAuthors(); //will work
      $authors = $book->getBookToAuthors(); //won't work
      the function of getBookToAuthors() is:

      public function getBookToAuthors()

      { return $this->bookToAuthors; }

      and the mapping is as follows:

      /**

      • @var BookToAuthor[]
        *
      • @OneToMany(targetEntity="BookToAuthor", mappedBy="book", cascade= {"persist"}

        )

      • @JoinColumn(name="id", referencedColumnName="book_id", onDelete="cascade")
        */
        private $bookToAuthors;
        please advise. i don't know what to do...

        Activity

        Koby Soto created issue -
        Koby Soto made changes -
        Field Original Value New Value
        Priority Blocker [ 1 ] Trivial [ 5 ]
        Hide
        Koby Soto added a comment - - edited

        sorry sorry sorry
        it was a mistake in the association target side.

        the target had One-To-One association instead of Many-To-One

        Show
        Koby Soto added a comment - - edited sorry sorry sorry it was a mistake in the association target side. the target had One-To-One association instead of Many-To-One
        Koby Soto made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Invalid [ 6 ]

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DDC-2080, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Koby Soto
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: