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()