Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-10-2008, 07:19 AM
Junior Member
 
Join Date: Jun 2008
Posts: 5
Default referenceMap onDelete

hello,

I'm building referencemaps. My contacts belong to a company. If I have a contact that is linked to a certain company. It's not possible to delete that company. If I'm correct, that's what the onDelete=>self::RESTRICT does. But I can't get it work. Any help?

PHP Code:
class ContactsModel{
  protected 
$_name        'tbl_contacts';
  protected 
$_primary     = array('ID');
  protected 
$_referenceMap    = array(
        
'Test' => array(
            
'columns'           => array('FK_company'),
            
'refTableClass'     => 'CompanyModel',
            
'refColumns'        => array('ID'),
            
'onDelete'    => self::RESTRICT
        
)); 
PHP Code:
class CompanyModel{
    protected 
$_name            'tbl_company';
    protected 
$_dependentTables = array('ContactsModel');
    protected 
$_primary         = array('ID'); 
PHP Code:
$CompanyRowset $CompanyModel->find($id);
$company        $CompanyRowset->current();
$company->delete() 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 11:19 PM.