【发布时间】:2011-09-08 03:12:39
【问题描述】:
我尝试以创建新类别的形式实现这样的效果:我在表单中添加了一个“选择列表”以显示我创建的所有类别,所以我尝试了:
> /**
> * @var string $parent
> *
> * @ORM\ManyToOne(targetEntity="ProductCategory")
> * @ORM\JoinColumn(name="product_category_id",
> referencedColumnName="id")
> */
>
> private $parent;
然后我想意识到:如果复选框 isRoot 被选中,则父选项设置为“root”,所以我写道:
> if($entity->getIsRoot()){
> $entity ->setParent('root');
> }
但是,它给了我一个例外: 给定“对象”、“字符串”类型的预期参数
怎么了?如何解决问题。
提前致谢! :)
【问题讨论】: