Doctrine 1
  1. Doctrine 1
  2. DC-431

findBy magic method doesn't work with many fields specified in the method name

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 1.2.1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      Using php 5.2.9 on wamp / Windows XP

      Description

      When trying to use 'findBy' magic method this way :

      Doctrine::getTable('Article')->findByIsPublishedAndIsModerate(Array(true,true),DOCTRINE::HYDRATE_ARRAY);

      It does not work because there is a bug in the __call magic method whereas calling

      Doctrine::getTable('Article')->findBy("IsPublishedAndIsModerate",Array(true,true),DOCTRINE::HYDRATE_ARRAY);

      works fine

      Hydration mode is not set to specified value and the arguments are encapsulated into a non necessary array.

      Please find the Table.php attached with the correction to make it work.

      line 2771 : '>' operator should be replaced with a '>=' operator
      line 2789 : '$arguments' should be replaced by '$arguments[0]' on the line 'return $this->$method($by, $arguments[0], $hydrationMode);'

      Thank you for including this patch in the next release.

      1. Table.php
        92 kB
        Jerome Calais

        Activity

        Hide
        Jonathan H. Wage added a comment -

        The syntax should be:

        Doctrine::getTable('Article')->findByIsPublishedAndIsModerate(true,true, DOCTRINE::HYDRATE_ARRAY);
        
        Show
        Jonathan H. Wage added a comment - The syntax should be: Doctrine::getTable('Article')->findByIsPublishedAndIsModerate( true , true , DOCTRINE::HYDRATE_ARRAY);

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Jerome Calais
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: