i've read some posts here about object-based models in cakephp being
released for v2.0. it's great that the cakephp developers are trying
to do this. to be honest, i really hate the array-based model in v1.x
right now. it's just not as agile and not as dry/yagni as i thought
cake was.
imagine having to do this in afterFind():
function afterFind(&$results)
{
if (is_array($results))
{
foreach (array_keys($results) as $i)
{
// For model finds
if (isset($results[$i]['CartItem']))
{
$results[$i]['CartItem']['giftwrapping_price']
= $results[$i]['CartItem']['giftwrap']
* $results[$i]['CartItem']['quantity']
* GIFTWRAPPING_CHARGE;
$results[$i]['CartItem']['total_price']
= $results[$i]['CartItem']['availability']
* $results[$i]['CartItem']['quantity']
* $results[$i]['Product']['price']
+
$results[$i]['CartItem']['giftwrapping_price'];
}
if (isset($results[$i]['Product']))
{
$results[$i]['Product'] =
$this->Product->afterFind($results[$i]['Product']);
}
// For association finds
if (isset($results[$i]['CartItems']))
{
foreach (array_keys($results[$i]['CartItems']) as
$ii)
{
$results[$i]['CartItems'][$ii]['giftwrapping_price']
=
$results[$i]['CartItems'][$ii]['giftwrap']
*
$results[$i]['CartItems'][$ii]['quantity']
* GIFTWRAPPING_CHARGE;
$results[$i]['CartItems'][$ii]['total_price']
=
$results[$i]['CartItems'][$ii]['availability']
*
$results[$i]['CartItems'][$ii]['quantity']
*
$results[$i]['CartItems'][$ii]['Product']['price']
+
$results[$i]['CartItems'][$ii]['giftwrapping_price'];
if
(isset($results[$i]['CartItems'][$ii]['Product']))
{
$results[$i]['CartItems'][$ii]['Product'] =
$this->Product->afterFind(
$results[$i]['CartItems'][$ii]['Product']);
}
}
}
}
}
return $results;
}
these are but one of the things that make me want to pull all hair off
my head and curse the fact that my clients hosts do not support rails
or at least have upgraded to php5 to support symfony.
no offense to the cakephp developers. i like cakephp, but array-based
model data??? really??? how agile could this be?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Cake PHP" 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/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---