Doctrine 1
  1. Doctrine 1
  2. DC-103

doctrine 1.0 not getting table correctly - huge bug - not usable

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.0.12
    • Fix Version/s: 1.2.0-BETA1
    • Component/s: Record
    • Labels:
      None
    • Environment:
      WIN XP

      Description

      In the method coreSetRelated from Record.php for 1-1 relation the table is not obtained correctly!

      if ($value !== self::$_null)

      { $relatedTable = $value->getTable(); $foreignFieldName = $relatedTable->getFieldName($rel->getForeign()); }

      instead of

      $relatedTable = $value->getTable();

      you should put

      $relatedTable = $rel->getTable();

      This is a huge bug that can be fixed very easily so please fix is asap!

      I can not deploy my project until this is fixed!

      Thanks a lot!

      I do not know if other versions are affected! I use symfony 1.2.9! Should I make a ticket also for Symfony!

      You do a great job with doctrine! Great project! I really like it

        Activity

        Hide
        Jonathan H. Wage added a comment -

        This sounds like a bug in your own code. $value should be an instance of Doctrine_Record and it is not. Make sure you're code is not passing an array or invalid value through to coreSetRelated(). If you're using symfony, a common cause of this is that you have an embedded form that has the same name as your relationship. This can cause issues currently.

        Show
        Jonathan H. Wage added a comment - This sounds like a bug in your own code. $value should be an instance of Doctrine_Record and it is not. Make sure you're code is not passing an array or invalid value through to coreSetRelated(). If you're using symfony, a common cause of this is that you have an embedded form that has the same name as your relationship. This can cause issues currently.
        Hide
        Nopcea Flavius added a comment -

        Hi!

        I am using symfony but I have a regular form! Not an embedded one!

        I have like this:

        $form->getObject()->setAuthorId($authorId);

        and when I do a $form->save I get an error in that method when dealing with the author!

        If I do a var_dump($value) it will not be an object but a string variable!

        $relatedTable = $value->getTable();

        I worked with previous versions of symfony/doctrine but once I upgraded to 1.2.9 it doesn't work anymore!

        To me it seems that in the saving process Doctrine is not getting the correct $value object!

        Show
        Nopcea Flavius added a comment - Hi! I am using symfony but I have a regular form! Not an embedded one! I have like this: $form->getObject()->setAuthorId($authorId); and when I do a $form->save I get an error in that method when dealing with the author! If I do a var_dump($value) it will not be an object but a string variable! $relatedTable = $value->getTable(); I worked with previous versions of symfony/doctrine but once I upgraded to 1.2.9 it doesn't work anymore! To me it seems that in the saving process Doctrine is not getting the correct $value object!
        Hide
        Nopcea Flavius added a comment -

        Hi!

        I am using symfony but I have a regular form! Not an embedded one!

        I have like this:

        $form->getObject()->setAuthorId($authorId);

        and when I do a $form->save I get an error in that method when dealing with the author!

        If I do a var_dump($value) it will not be an object but a string variable!

        $relatedTable = $value->getTable();

        I worked with previous versions of symfony/doctrine but once I upgraded to 1.2.9 it doesn't work anymore!

        To me it seems that in the saving process Doctrine is not getting the correct $value object!

        Show
        Nopcea Flavius added a comment - Hi! I am using symfony but I have a regular form! Not an embedded one! I have like this: $form->getObject()->setAuthorId($authorId); and when I do a $form->save I get an error in that method when dealing with the author! If I do a var_dump($value) it will not be an object but a string variable! $relatedTable = $value->getTable(); I worked with previous versions of symfony/doctrine but once I upgraded to 1.2.9 it doesn't work anymore! To me it seems that in the saving process Doctrine is not getting the correct $value object!
        Hide
        Olivier added a comment -

        Quite same problem here.

        My code worked fine with Symfony 1.2.7, but I have the same fatal error since 1.2.8. If I change $value to $rel, everything works fine.

        I'm using embedded forms with Doctrine and I have another way to solve it :

        • With this, I've got the issue :
          $this->embedForm('contact_physique', $contactForm);
        • But no anymore with this :
          $this->embedForm('ContactPhysique', $contactForm);

        contact_physique is a relationship in my schema.

        I do not know if that "new behavior" comes from Doctrine or Symfony, but it may help with Nopcea Flavius' problem.

        Regards

        Show
        Olivier added a comment - Quite same problem here. My code worked fine with Symfony 1.2.7, but I have the same fatal error since 1.2.8. If I change $value to $rel, everything works fine. I'm using embedded forms with Doctrine and I have another way to solve it : With this, I've got the issue : $this->embedForm('contact_physique', $contactForm); But no anymore with this : $this->embedForm('ContactPhysique', $contactForm); contact_physique is a relationship in my schema. I do not know if that "new behavior" comes from Doctrine or Symfony, but it may help with Nopcea Flavius' problem. Regards

          People

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

            Dates

            • Created:
              Updated:
              Resolved: