在createForm中插入实体(Symfony 2)

时间:2018-09-27 09:22:23

标签: symfony entity

我花了几天时间找到解决方案。 我无法在createForm中传递我的实体,但只有在传递特定于实体的getter时,它才有效

不工作:

a <- 1:15
b <- rep(c("Blue", "Green", "White"),5)
df <- data.frame(Numbers=a, colours=b)
df %>% 
  select(Numbers, colours) %>% 
  filter(colours==levels(df$colours)[1:3])

不工作:

$storyboard = $this->getDoctrine()
            ->getRepository('TutoAppBundle:Storyboard')
            ->find($id_screen);

$formSettings = $this->createForm( new MosaicCorporateCastType( ), $storyboard );

工作:

    $storyboard = $this->getDoctrine()
            ->getRepository('TutoAppBundle:Storyboard')
            ->find($id_screen);

$formSettings = $this->createForm( new MosaicCorporateCastType( ), $storyboard->getPosition() );

我试图理解为什么... 如果您有任何建议,我很高兴。

谢谢您的帮助

这是mosaicCorporateCastType:

MosaicCorporateCastType类扩展AbstractType {

    $storyboard = $this->getDoctrine()
            ->getRepository('TutoAppBundle:Storyboard')
            ->find($id_screen);

$formSettings = $this->createForm( new MosaicCorporateCastType( ), $storyboard->getSettings() );

}

0 个答案:

没有答案