简体   繁体   中英

One-to-many relationship in the same table in zend

I have groupTable(group_id,group_name,group_date,group_parent_id)
in face each group have many group child. I create groupModel and I want to begin coding is this right code to handle?

protected $_name = 'group';   
protected $_dependentTables = array('Model_group');  
protected $_referenceMap = array('Model_group' =>   
    array('columns' => array('group_parent_id') ,   
    'refTableClass' => 'Model_group' ,   
    'refColumns' => array('group_id') ,   
    'onDelete' => self::CASCADE ,   
    'onUpdate' => self::RESTRICT)  
);

一对多意味着一个以上的表

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM