【发布时间】:2014-01-05 21:54:52
【问题描述】:
我有两个实体:俱乐部和用户。在用户实体中,我创建了一个多对多表:
/**
* @ORM\ManyToMany(targetEntity="Club", inversedBy="users")
* @ORM\JoinTable(name="sms_followers")
**/
private $smsfollower;
现在我想将数据添加到表中。我用这个:
//Get the club (no error handling created
$getclub = $this->em->getRepository('Club')->findOneBy(array('id' => $clubid));
//Get the user by login ID
$getuser = $this->em->getRepository('User')->findOneBy(array('id' => '7'));
//Insert the userID and ClubID to the table sms_followers
$getuser = $getclub->addSmsfollower();
我无法完成这项工作...谁能帮帮我?
请让英语尽可能简单,我来自荷兰
【问题讨论】:
标签: php symfony join doctrine-orm