属性中的注释不存在,或者无法自动加载

时间:2016-12-27 15:40:09

标签: php symfony

我正在使用Symfony 2.7 - 当我想生成getter和setter时,他们会告诉我:

The annotation "@doctrine\ORM\mapping" in property MostVenteBundle\Entity\commande::$lignes_cmd does not exist, or could not be auto-loaded
<?php

namespace Most\VenteBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * commande
 *
 * @ORM\Table()
 * @ORM\Entity
 */
class commande
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="date_cmd", type="date")
     */
    private $dateCmd;

    /**
     * @var string
     *
     * @ORM\Column(name="adresse_liv", type="string", length=33)
     */
    private $adresseLiv;

    /**
     * @ORM\ManyToOne(targetEntity="Client", inversedBy="commandes")
     * @ORM\joinColumn(name="id_client", referencedColumnName="id")
     */
    private $client;


    /**    
     * @ORM/OneToMany(targetEntity="ligne_cmd", mappedBy="commande")     
     */
    private $lignes_cmd;

    public function __construct()
    {
        $this->lignes_cmd = new \Doctrine\Common\Collection\ArrayCollection();
    }

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set dateCmd
     *
     * @param \DateTime $dateCmd
     * @return commande
     */
    public function setDateCmd($dateCmd)
    {
        $this->dateCmd = $dateCmd;

        return $this;
    }

    /**
     * Get dateCmd
     *
     * @return \DateTime 
     */
    public function getDateCmd()
    {
        return $this->dateCmd;
    }

    /**
     * Set adresseLiv
     *
     * @param string $adresseLiv
     * @return commande
     */
    public function setAdresseLiv($adresseLiv)
    {
        $this->adresseLiv = $adresseLiv;

        return $this;
    }

    /**
     * Get adresseLiv
     *
     * @return string 
     */
    public function getAdresseLiv()
    {
        return $this->adresseLiv;
    }
}

1 个答案:

答案 0 :(得分:1)

/**    
 * @ORM\OneToMany(targetEntity="ligne_cmd", mappedBy="commande")     
 */
private $lignes_cmd;
你写了@ ORM / OneToMany而不是@ORM \ OneToMany