我有几张表并为他们定义了关系。
{Table Department} {Table Unit} {Table Branch}
一个部门可以有多个分支,一个分支只能属于一个部门。我需要能够获得部门名称,departmentid,branchname
Branch has an instance of departmentid in it.
如何在一次ORM通话中提取此内容?
class Model_Admin_Departments extends ORM
{
protected $_has_many = array('branches' => array ());
class Model_Admin_Branches extends ORM
{ protected $ _belongs_to = array('departments'=> array());
我还在db端创建了外键约束,并在delete上创建了动作级联。这会导致问题还是没问题?