我有几个表并为它们定义了关系。
{Table Department} {Table Unit} {Table Branch}
一个部门可以有多个分支,一个分支只能属于一个部门。我需要能够获取部门名称、部门 ID、分支名称
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());
我还在数据库端创建了外键约束,删除操作级联。这会导致问题还是很好?