#6276: afterFind() called twice / documentation does not match behaviour
--------------------------------------------------+-------------------------
Reporter: nemosoft | Owner:
Type: RFC | Status: new
Priority: Medium | Milestone: 1.2.x.x
Component: Model | Version: 1.2 Final
Severity: Normal | Resolution:
Keywords: afterFind primary data corruption | Php_version: PHP 5
Cake_version: 8120 |
--------------------------------------------------+-------------------------
Comment (by deizel):
Please bear in mind I have done next to no research before posting this:
Just an observation, but without the second pass it would make it
difficult for someone to merge two records together in an afterFind()
callback.
I can't immediately think of a solid reason why someone might want to do
this, but if there was a flag similar to $primary - one could check for
this during the second pass, and this would remain a possibility.
Alternatively, the first pass(es) could be scrapped, and the developer
could implement record-looping himself as is documented:
{{{
function afterFind($results, $primary) {
foreach ($results as $result) {
$result = $this->_combineNames($result);
$result = $this->_calculateTotal($result);
}
return parent::afterFind($results, $primary);
}
}}}
Apologies if I am oversimplifying things here - just food for thought -
feel free to correct me on anything I have overlooked.
--
Ticket URL: <https://trac.cakephp.org/ticket/6276#comment:2>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC.
Our primary goal is to provide a structured framework that enables PHP users at
all levels to rapidly develop robust web applications, without any loss to
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"tickets cakephp" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---