Details

    • Type: Improvement
    • Status: Open
    • Priority: 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
        gena01 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
        gena01 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
        gena01 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
        gena01 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
        jwage Jonathan H. Wage added a comment -

        Was this always like this or did it change recently?

        Show
        jwage Jonathan H. Wage added a comment - Was this always like this or did it change recently?
        Hide
        gena01 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
        gena01 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:
            guilhermeblanco Guilherme Blanco
            Reporter:
            orlanster Roman
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: