Doctrine 1
  1. Doctrine 1
  2. DC-725

Call record->get('RelationManyToManyName', FALSE) corrupt the record and generate a exception when calling record->save()

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: 1.2.1, 1.2.2
    • Fix Version/s: None
    • Component/s: Record
    • Labels:
      None
    • Environment:

      Description

      Imagine a simple case. Contact can have many categories.
      Doing thoses calls:

      $c = Doctrine::getTable('Contact')->findOneById($id);
      $c->get('Categories', false);
      $c->save();
      

      Generate the following error

      PHP Fatal error:  Call to a member function save() on a non-object in /lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection/UnitOfWork.php on line 443
      PHP Stack trace:
      PHP   1. {main}() /test/doctrine/get_with_no_load_corrupt_many_to_many_assoc_.php:0
      PHP   2. Doctrine_Record->save() /test/doctrine/get_with_no_load_corrupt_many_to_many_assoc_.php:51
      PHP   3. Doctrine_Connection_UnitOfWork->saveGraph() /lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Record.php:1705
      PHP   4. Doctrine_Connection_UnitOfWork->saveAssociations() /lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection/UnitOfWork.php:137
      

        Activity

        David Jeanmonod created issue -
        David Jeanmonod made changes -
        Field Original Value New Value
        Description Imagine a simple case. Contact can have many categories.
        Doing thoses calls:
        {{
        $c = Doctrine::getTable('Contact')->findOneById($id);
        $c->get('Categories', false);
        $c->save();
        }}

        Generate the following error
        {{
        PHP Fatal error: Call to a member function save() on a non-object in /lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection/UnitOfWork.php on line 443
        PHP Stack trace:
        PHP 1. {main}() /test/doctrine/get_with_no_load_corrupt_many_to_many_assoc_.php:0
        PHP 2. Doctrine_Record->save() /test/doctrine/get_with_no_load_corrupt_many_to_many_assoc_.php:51
        PHP 3. Doctrine_Connection_UnitOfWork->saveGraph() /lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Record.php:1705
        PHP 4. Doctrine_Connection_UnitOfWork->saveAssociations() /lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection/UnitOfWork.php:137
        }}

        Imagine a simple case. Contact can have many categories.
        Doing thoses calls:
        {code:borderStyle=solid}
        $c = Doctrine::getTable('Contact')->findOneById($id);
        $c->get('Categories', false);
        $c->save();
        {code}

        Generate the following error
        {code:borderStyle=solid}
        PHP Fatal error: Call to a member function save() on a non-object in /lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection/UnitOfWork.php on line 443
        PHP Stack trace:
        PHP 1. {main}() /test/doctrine/get_with_no_load_corrupt_many_to_many_assoc_.php:0
        PHP 2. Doctrine_Record->save() /test/doctrine/get_with_no_load_corrupt_many_to_many_assoc_.php:51
        PHP 3. Doctrine_Connection_UnitOfWork->saveGraph() /lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Record.php:1705
        PHP 4. Doctrine_Connection_UnitOfWork->saveAssociations() /lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection/UnitOfWork.php:137
        {code}

        Hide
        David Jeanmonod added a comment -

        Test case for the bug

        Show
        David Jeanmonod added a comment - Test case for the bug
        David Jeanmonod made changes -

        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=DC-725, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            David Jeanmonod
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: