Postgres and Model-del() problem

2006-09-18 Thread Felipe Nascimento

Hi,

I had an application that was using Mysql as the database. We switched
to Postgres cause of client's request. Then we started to have some
problems with some delete operations.

Taking a look at the model_php5.php class, I saw that there is:

if ($this-id  $db-delete($this)) {
$this-_deleteMulti($id);
$this-_deleteHasMany($id, $cascade);
$this-_deleteHasOne($id, $cascade);
$this-afterDelete();
$this-_clearCache();
$this-id = false;
return true;
}

But this causes an error in my Postgres beacause this operation above
tries to dele the entity berfore trying to delete the relations that
depend on the entity. So we get FK constraint error when
$db-delete($this) is executed, which seems natural to me.

Shouldn't the order of these delete calls be changed? The
$db-delete($this) call should not be the last one?

tks

[]s
Felipe

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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
-~--~~~~--~~--~--~---



Model::read() : fetch the first level with conditional argument

2006-09-01 Thread Felipe Nascimento

Hi all,

I have the following model objects:

MailList hasManyAndBelongsTo Email

The Email object has an active boolean attribute. In the page that
shows the details of a MailList and wanted to list only the active
Emails of that MailList.

If I use MailList::read(null, $id), then I get all Emails in the
resulting query. How is a good way to solve this? Do I need to write a
specific SQL query and use query() to get only the active Emails from
a MailList?? Or is there a MailList-someMethod() that I can use?

Tks
Felipe

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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
-~--~~~~--~~--~--~---