Bug Report #2098
ORM pulling related models fails on second attempt
| Status: | Closed | Start date: | 09/10/2009 | |
|---|---|---|---|---|
| Priority: | Urgent | Due date: | ||
| Assignee: | % Done: | 100% |
||
| Category: | Libraries:ORM | |||
| Target version: | 2.4 | |||
| Resolution: | fixed | Points: |
Description
Here is the problem i've discovered:
$model = ORM::factory('table')->find(1);
//displays 1 record(correct)
var_dump(count($model->relateds->find_all()));
//displays ALL records(incorrect)
var_dump(count($model->relateds->find_all()));
"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
fixing #2098
History
Updated by Ben Rogers over 3 years ago
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
Applied in changeset r4604.
Updated by Ben Rogers over 3 years ago
- Resolution set to fixed