On Aug 18, 8:43 am, "Jon Bennett" <[EMAIL PROTECTED]> wrote:
> ...
> a far easier solution to the problem would be to store an interger for
> the status, you could assign things like so:
>
> 0 - unpaid/unprocessed
> 1 - paid/processed
> 2 - dispatched
> 3 - refunded
>

Before I finally discovered that there were replies to my
question :)....I did end up going with a similar solution in order to
avoid "hackiness".

Which actually brings me to another question:

Should the following work?:

Account has many Purchase
Purchase belongs to Account

$this->Account->id = 1;
$this->Account->read();

$this->Account->Purchases->find('unpaid');

>From Purchases model (overriding find method taken from
http://c7y.phparch.com/c/entry/1/art,mvc_and_cake):
function find($type,
{
    ...
    case 'unpaid':
                $params = array_merge($params, array('conditions' =>
array('Purchase.status' => 'pending')));
                return parent::find('all', $params);
...
}

My hopes were that the above would produce the following SQL (it does
not):

SELECT Purchase.*
FROM purchases AS Purchase LEFT JOIN accounts AS Account ON
(Account.id = Purchase.account_id)
WHERE Purchase.status = 'pending' AND Account.id = 1;
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to