Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.3
    • Fix Version/s: None
    • Component/s: Query
    • Labels:
      None

      Description

      Query fetchOne method now retrieves and hydrates all collection, which can be time consumable. I suggest to add limit 1 in fetchOne method.

        Activity

        Hide
        Gennady Feldman added a comment -

        This is a defect. People assume there's an implied limit(1) in the query because of fetchOne(). Please fix this, this is pretty serious stuff.

        Show
        Gennady Feldman added a comment - This is a defect. People assume there's an implied limit(1) in the query because of fetchOne(). Please fix this, this is pretty serious stuff.
        Hide
        Gennady Feldman added a comment -

        Doctrine_Table actually "works around" the issue but explicitly doing limit(1) before doing fetchOne():

        public function findOneBy($fieldName, $value, $hydrationMode = null)

        { return $this->createQuery('dctrn_find') ->where($this->buildFindByWhere($fieldName), (array) $value) ->limit(1) ->fetchOne(array(), $hydrationMode); }
        Show
        Gennady Feldman added a comment - Doctrine_Table actually "works around" the issue but explicitly doing limit(1) before doing fetchOne(): public function findOneBy($fieldName, $value, $hydrationMode = null) { return $this->createQuery('dctrn_find') ->where($this->buildFindByWhere($fieldName), (array) $value) ->limit(1) ->fetchOne(array(), $hydrationMode); }
        Hide
        Jonathan H. Wage added a comment -

        Was this always like this or did it change recently?

        Show
        Jonathan H. Wage added a comment - Was this always like this or did it change recently?
        Hide
        Gennady Feldman added a comment -

        Frankly I have no idea.

        Also adding a limit(1) shouldn't break anything and is straight forward. We would also want to fix findOneBy not to do limit(1) since fetchOne() should take care of this after the fix is in place.

        Show
        Gennady Feldman added a comment - Frankly I have no idea. Also adding a limit(1) shouldn't break anything and is straight forward. We would also want to fix findOneBy not to do limit(1) since fetchOne() should take care of this after the fix is in place.

          People

          • Assignee:
            Guilherme Blanco
            Reporter:
            Roman
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: