Doctrine Project

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
Doctrine 1
  • Doctrine 1
  • DC-916

fetchOne defect

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Improvement Improvement
  • Status: Open 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

Ascending order - Click to sort in descending order
  • All
  • Comments
  • History
  • Activity
  • Source
Hide
Permalink
Gennady Feldman added a comment - 21/Jan/11 5:35 PM

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 - 21/Jan/11 5:35 PM 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
Permalink
Gennady Feldman added a comment - 21/Jan/11 7:57 PM

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 - 21/Jan/11 7:57 PM 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
Permalink
Jonathan H. Wage added a comment - 23/Jan/11 2:17 PM

Was this always like this or did it change recently?

Show
Jonathan H. Wage added a comment - 23/Jan/11 2:17 PM Was this always like this or did it change recently?
Hide
Permalink
Gennady Feldman added a comment - 24/Jan/11 11:27 AM

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 - 24/Jan/11 11:27 AM 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
Vote (1)
Watch (1)

Dates

  • Created:
    05/Nov/10 4:32 AM
    Updated:
    24/Jan/11 11:27 AM
  • Atlassian JIRA (v5.2.7#850-sha1:b2af0c8)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Doctrine Project. Try JIRA - bug tracking software for your team.