Bug Report #2098

ORM pulling related models fails on second attempt

Added by Ben Rogers over 5 years ago. Updated over 5 years ago.

Status:ClosedStart date:09/10/2009
Priority:UrgentDue date:
Assignee:Ben Rogers% Done:


Target version:2.4
Resolution:fixed Points:


Here is the problem i've discovered:

$model = ORM::factory('table')->find(1);
//displays 1 record(correct)
//displays ALL records(incorrect)

"table" has many "relateds"

currently when looking at __get the problem lies in the fact that repeated calls to related tables are stored into an array, since an ORM object is returned with a where() function applied, future calls fail as find_all() has been called and clears the where command.

my solution, is to remove the caching of these related objects, this would pertain specifically to has_many, and has_and_belongs_to_many objects.

Associated revisions


#1 Updated by Ben Rogers over 5 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

Applied in changeset r4604.

#2 Updated by Ben Rogers over 5 years ago

  • Resolution set to fixed

Also available in: Atom PDF