Doctrine 1
  1. Doctrine 1
  2. DC-835

Inconsistent record validation on a notnull foreign key when the local relation is set

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.1
    • Fix Version/s: None
    • Component/s: Record, Relations, Validators
    • Labels:
      None

      Description

      Doctrine_Validator_ForeignKeys_TestCase#testForeignKeyIsValidIfLocalRelationIsSet()

      This test passes fine as is. But it fails if I make the following change:

      public function testForeignKeyIsValidIfLocalRelationIsSet()
      {
          //$person = new TestPerson();
          $address = new TestAddress();
              
          //$address->Person = $person;    
          $address->Person->first_name = "John";
              
          $table = $address->getTable();
          $errors = $table->validateField('person_id', $address->person_id, $address);
              
          $this->assertEqual(0, $errors->count());
      }
      

      The only difference is that instead of explicitly assigning $address->Person, I'm letting it happen automatically when assigning the first name. What is it about the property chaining when creating the related record that screws up doctrine's internal reference tracking?

      1. dc-835-patch.txt
        2 kB
        Adam Huttler
      2. ForeignKeysTestCase.php
        2 kB
        Adam Huttler

        Activity

        Hide
        Adam Huttler added a comment -

        This is an existing test case for which I've added two tests. The first one fails, while the second passes. The first one captures the issue I'm experiencing.

        Show
        Adam Huttler added a comment - This is an existing test case for which I've added two tests. The first one fails, while the second passes. The first one captures the issue I'm experiencing.
        Hide
        Adam Huttler added a comment -

        This patch augments the test file with the new test and also makes a change to Doctrine_Related_LocalKey that causes the test to pass.

        Unfortunately, it causes another test to fail: 1072.

        I don't fully understand test 1072, but it appears to be testing closely related behavior (i.e. relation chaining).

        What do you think?

        Show
        Adam Huttler added a comment - This patch augments the test file with the new test and also makes a change to Doctrine_Related_LocalKey that causes the test to pass. Unfortunately, it causes another test to fail: 1072. I don't fully understand test 1072, but it appears to be testing closely related behavior (i.e. relation chaining). What do you think?

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Adam Huttler
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: