SYMFONY2:该属性或其中一个方法都不存在,并且在类中具有公共访问权限

SYMFONY2:该属性或其中一个方法都不存在,并且在类中具有公共访问权限,symfony,Symfony,在表单中保存数据后,我不断收到以下错误: 属性“righeFattura”或方法“addRigheFatturon()”/“removeRigheFatturon()”、“addRigheFatturum()”/“removeRigheFatturum()”、“setRigheFattura()”、“righeFattura()”、“\uu集()”或“\uu调用()”都不存在,并且在类“Kritek\Bundle\GestionaleBundle\Entity\Fatture”中具有公共访问权限

在表单中保存数据后,我不断收到以下错误:

属性“righeFattura”或方法“addRigheFatturon()”/“removeRigheFatturon()”、“addRigheFatturum()”/“removeRigheFatturum()”、“setRigheFattura()”、“righeFattura()”、“\uu集()”或“\uu调用()”都不存在,并且在类“Kritek\Bundle\GestionaleBundle\Entity\Fatture”中具有公共访问权限

这是我的发票类别:

    class Fatture
    {

        /**
             * @ORM\OneToMany(targetEntity="FattureRighe", mappedBy="fattura", cascade={"persist","remove"}, orphanRemoval=true)
             **/

            private $righeFattura;

        /**
             * Constructor
             */
            public function __construct()
            {
                $this->ordine = new ArrayCollection();
                $this->righeFattura = new ArrayCollection();
                $this->createdate = new \DateTime();
                $this->billingdate = new \DateTime();
                if ($this->getModifyDate() == null) {
                    $this->setModifyDate(new \DateTime());
                }
            }

    /**
         * Add righeFattura
         *
         * @param \Kritek\Bundle\GestionaleBundle\Entity\FattureRighe $righeFattura
         *
         * @return Fatture
         */
        public function addRigheFattura(\Kritek\Bundle\GestionaleBundle\Entity\FattureRighe $righeFattura)
        {
            $this->righeFattura[] = $righeFattura;
            $righeFattura->setFattura($this);

            return $this;
        }

    /**
     * Remove righeFattura
     *
     * @param \Kritek\Bundle\GestionaleBundle\Entity\FattureRighe $righeFattura
     */
    public function removeRigheFattura(\Kritek\Bundle\GestionaleBundle\Entity\FattureRighe $righeFattura)
    {
        $this->righeFattura->removeElement($righeFattura);
    }

    /**
     * Get righeFattura
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getRigheFattura()
    {
        return $this->righeFattura;
    }
}
这是我的发票行:

class FattureRighe
{
    /**
     * @var \Kritek\Bundle\GestionaleBundle\Entity\Fatture
     *
     * @ORM\ManyToOne(targetEntity="Fatture", inversedBy="righeFattura")
     * @ORM\JoinColumn(name="fattura_id", referencedColumnName="id")
     **/
    private $fattura;

/**
     * Set fattura
     *
     * @param \Kritek\Bundle\GestionaleBundle\Entity\Fatture $fattura
     * @return FattureRighe
     */
    public function setFattura(\Kritek\Bundle\GestionaleBundle\Entity\Fatture $fattura = null)
    {
        $this->fattura = $fattura;

        return $this;
    }

    /**
     * Get fattura
     *
     * @return \Kritek\Bundle\GestionaleBundle\Entity\Fatture 
     */
    public function getFattura()
    {
        return $this->fattura;
    }
}
发票类型:

class FattureType extends AbstractType
{
    protected $em;

    function __construct(EntityManager $em)
    {
        $this->em = $em;
    }

    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('righeFattura', 'collection', array(
                'type' => new FattureRigheType(),
                'required' => true,
                'allow_add' => true,
                'allow_delete' => true,
                'by_reference' => false,
                'label' => false,
                'cascade_validation' => true,
            ));
    }
}
发票控制员:

/**
     * Creates a new Fatture entity.
     *
     * @Route("/dettaglio/{id}", name="fattura_dettaglio", options={"expose"=true})
     * @Template("KritekGestionaleBundle:Fatture:dettaglio.html.twig")
     */

    public function dettaglioAction($id, Request $request)
    {
$originalRigheFattura = new ArrayCollection();

        // Crea un array degli oggetti Tag attualmente nella base dati
        foreach ($fattura->getRigheFattura() as $righeFattura) {
            $originalRigheFattura->add($righeFattura);
        }
$editForm = $this->createForm(new FattureType($this->getDoctrine()->getManager()), $fattura);
$editForm->handleRequest($request);

        if ($editForm->isValid()) {


            foreach ($originalRigheFattura as $rigaFattura) {
                if (false === $fattura->getRigheFattura()->contains($rigaFattura)) {
                    $em->remove($rigaFattura);
                }
            }

            $em->persist($fattura);
            $em->flush();

            // ritorna in lista ordini
            return $this->redirect($this->generateUrl('fatture_list'));

    }
}
有什么想法吗?哪里错了? 我在订单中也做了同样的事情,但只是发票不起作用

这是InvoiceRowsType:

class FattureRigheType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('quantita')
            ->add('sconto')
            ->add('cod')
            ->add('prodotto')
            ->add('prezzounit')
            ->add('prezzoimp')
            ->add('iva')
            ->add('ivaeur')
            ->add('prezzotot')
            ->add('rifCat')
//            ->add('fatturaId')
//            ->add('fattura')
        ;
    }

    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'Kritek\Bundle\GestionaleBundle\Entity\FattureRighe'
        ));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'kritek_bundle_gestionalebundle_fatturerighe';
    }
}

检查您的FattureRigheType类。您有一个输入错误:Righefatturo不可能重复的