Re: [fw-general] Zend_Db_Table Relationships Delete/Update

2007-07-24 Thread James Dempster

If I understand correctly you would simply extend the Zend_Db_Table_Abstract
as say My_Db_Table and overload the delete and update functions doing
nothing. You would that use this extended class e.g. My_Db_Table as the
table handlers.

I dont quite know why you would want to do this. But heres an example.

class My_Db_Table extends Zend_Db_Table_Abstract {
   public function update($where, $data) {}
   public function date($where) {}
}

class My_Db_Table extends My_Db_Table {
   protected $_name = 'my_table_name';
}

$testTable = new My_Db_Table();
$testTableRowset = $testTable-fetchAll(); // returns all rows

$testTable-update($where, $data); // would call the first update which does
nothing

This is example code only to give an idea.

On 7/24/07, Jack Sleight [EMAIL PROTECTED] wrote:


Hi,
I'm using the database to manage delete and update actions in related
tables, so do I need to tell Zend_Db_Table not to try to emulate these
for me? And if so, how?
Thanks,
--
Jack





--
Regards,
James Dempster

--


Re: [fw-general] Zend_Db_Table Relationships Delete/Update

2007-07-24 Thread Dillon Woods

On 7/24/07, Jack Sleight [EMAIL PROTECTED] wrote:


Hi,
I'm using the database to manage delete and update actions in related
tables, so do I need to tell Zend_Db_Table not to try to emulate these
for me? And if so, how?



Do you mean that you have cascading UPDATE and DELETE rules set up on the
dependent tables in your database?  If your RDBMS supports it, it is
considered a best practice to do what you are doing.  Unless you
specifically declare onUpdate and onDelete variables in your $_referenceMap,
then Zend_Db_Table will not emulate them.  For more information see
http://framework.zend.com/manual/en/zend.db.table.relationships.html#zend.db.table.relationships.cascadingin
the framework documentation.

Dillon


Re: [fw-general] Zend_Db_Table Relationships Delete/Update

2007-07-24 Thread Jack Sleight
Yes the RDBMS supports them (MySQL) so I set them up there. Thanks, just 
wanted to check ZF wouldn't try to do anything automagically.


Dillon Woods wrote:
On 7/24/07, *Jack Sleight* [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] wrote:


Do you mean that you have cascading UPDATE and DELETE rules set up on 
the dependent tables in your database?  If your RDBMS supports it, it 
is considered a best practice to do what you are doing.  Unless you 
specifically declare onUpdate and onDelete variables in your 
$_referenceMap, then Zend_Db_Table will not emulate them.  For more 
information see 
http://framework.zend.com/manual/en/zend.db.table.relationships.html#zend.db.table.relationships.cascading 
http://framework.zend.com/manual/en/zend.db.table.relationships.html#zend.db.table.relationships.cascading 
in the framework documentation.


Dillon


--
Jack