0
我在网站上建立了学说,我在关系上遇到了麻烦。我有一个拥有多个配置文件的帐户对象。每个配置文件有一个帐户。当我尝试创建一个新的配置文件并坚持然后刷新时,表单会挂起而不执行任何操作。如果我删除了flush,我得到打印的调试语句,但没有任何东西被持久化。与学说的关系麻烦PHP
模型属性。
在帐户
/**
* The profiles belonging to this account.
*
* @OneToMany(targetEntity="Profile_Model_Profile", mappedBy="account")
*/
protected $profiles;
在档案
/**
* The account that owns this profile
*
* @ManyToOne(targetEntity="Account_Model_Account",
inversedBy="profiles",
cascade={"detach", "persist", "merge"},
fetch="EAGER")
* @JoinColumn(name="account_id", referencedColumnName="id")
*/
protected $account;
创建(设置所有属性后)
$profile->setAccount($account);
$account->addProfile($profile);
$em->persist($profile);
$em->persist($account);
$em->flush();
我在做什么错在这里?
从问题标题看来,您听起来应该已经购买了PHP教程PHP情人节礼物,并没有花费太多时间检查出现的所有其他热门框架。 – rdlowrey 2011-12-17 01:10:07