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

时间:2015-04-11 12:21:17

标签: symfony doctrine-orm annotations

当我想在Symfony2上生成我的数据库模式时,我有一个奇怪的问题,一个attribut不被接受......

The annotation "@Doctrine\ORM\Mapping\ManyToOne" in property L3L2\EntraideBundle\Entity\RendezVous::$idDispoProf does not exist, or could not be auto-loaded.

它甚至更奇怪,因为它在MacOS X和Windows(Vista& Seven)上工作。我试图让它适用于Ubuntu Server VM。

这是我的实体代码:

<?php

namespace L3L2\EntraideBundle\Entity;

use L3L2\UserBundle\Entity\User;
use Doctrine\ORM\Mapping as ORM;

/**
 * RendezVous
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="L3L2\EntraideBundle\Entity\RendezVousRepository")
 */
class RendezVous
{
    /**
     * Constructor
     */
    public function __construct()
    {
        $this->vuEleve = "NON";
        $this->vuProf = "NON";
}

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

/**
 * @var string
 *
 * @ORM\Column(name="lieu", type="string", length=255)
 */
private $lieu;

/**
 * @var string
 *
 * @ORM\Column(name="statut", type="string", length=255)
 */
private $statut;

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

/**
 * @var \DateTime
 *
 * @ORM\Column(name="time", type="time")
 */
private $time;
/**
 * @var \DateTime
 *
 * @ORM\Column(name="datetimeDebut", type="datetime")
 */
private $datetimeDebut;


/**
 * @var \DateTime
 *
 * @ORM\Column(name="datetimeFin", type="datetime")
 */
private $datetimeFin;


//Création de OneToOne vers Evaluation
/**
* @ORM\OneToOne(targetEntity="L3L2\EntraideBundle\Entity\Evaluation", mappedBy="idRdvEval")
* @ORM\JoinColumn(name="id_eval", referencedColumnName="id")
*/
protected $evaluationRdv;



//PROBLEM HERE !!


// Création de ManytoOne vers Disponibilite   
/**    
* @ORM\ManytoOne(targetEntity="L3L2\EntraideBundle\Entity\Disponibilite")   
* @ORM\JoinColumn(name="id_dispo_prof", referencedColumnName="id", onDelete="SET NULL")    
*/     
protected $idDispoProf;





//Création de ManyToOne vers Cours
/**
* @ORM\ManyToOne(targetEntity="L3L2\EntraideBundle\Entity\Cours", inversedBy="rendezVousCours")
* @ORM\JoinColumn(name="id_cours_rdv", referencedColumnName="id")
*/
protected $idCoursRdv;

//Création de ManyToOne vers User 
/**
* @ORM\ManyToOne(targetEntity="L3L2\UserBundle\Entity\User", inversedBy="rendezVousEleve")
* @ORM\JoinColumn(name="id_eleve_rdv", referencedColumnName="id")
*/
protected $idEleveRdv;

/**
 * @var string
 *
 * @ORM\Column(name="vuEleve", type="string", length=255, nullable=true)
 */
private $vuEleve;

 /**
 * @var string
 *
 * @ORM\Column(name="vuProf", type="string", length=255, nullable=true)
 */
private $vuProf;

//Création de ManyToOne vers User 
/**
* @ORM\ManyToOne(targetEntity="L3L2\UserBundle\Entity\User")
* @ORM\JoinColumn(name="dernierModif", referencedColumnName="id")
*/
private $dernierModif;

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

/**
 * Set lieu
 *
 * @param string $lieu
 * @return RendezVous
 */
public function setLieu($lieu)
{
    $this->lieu = $lieu;

    return $this;
}

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

/**
 * Set statut
 *
 * @param string $statut
 * @return RendezVous
 */
public function setStatut($statut)
{
    $this->statut = $statut;

    return $this;
}

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

/**
 * Set evaluationRdv
 *
 * @param \L3L2\EntraideBundle\Entity\Evaluation $evaluationRdv
 * @return RendezVous
 */
public function setEvaluationRdv(\L3L2\EntraideBundle\Entity\Evaluation $evaluationRdv = null)
{
    $this->evaluationRdv = $evaluationRdv;

    return $this;
}

/**
 * Get evaluationRdv
 *
 * @return \L3L2\EntraideBundle\Entity\Evaluation 
 */
public function getEvaluationRdv()
{
    return $this->evaluationRdv;
}


/**
 * Set idEleveRdv
 *
 * @param \L3L2\UserBundle\Entity\User $idEleveRdv
 * @return RendezVous
 */
public function setIdEleveRdv(\L3L2\UserBundle\Entity\User $idEleveRdv = null)
{
    return $this->idEleveRdv = $idEleveRdv;
}

/**
 * Get idEleveRdv
 *
 * @return \L3L2\UserBundle\Entity\User 
 */
public function getIdEleveRdv()
{
    return $this->idEleveRdv;
}

/**
 * Set idDispoProf
 *
 * @param \L3L2\EntraideBundle\Entity\Disponibilite $idDispoProf
 * @return RendezVous
 */
public function setIdDispoProf(\L3L2\EntraideBundle\Entity\Disponibilite $idDispoProf = null)
{
    return $this->idDispoProf = $idDispoProf;
}

/**
 * Get idDispoProf
 *
 * @return \L3L2\EntraideBundle\Entity\Disponibilite 
 */
public function getIdDispoProf()
{
    return $this->idDispoProf;
}

/**
 * Set idCoursRdv
 *
 * @param \L3L2\EntraideBundle\Entity\Cours $idCoursRdv
 * @return RendezVous
 */
public function setIdCoursRdv(\L3L2\EntraideBundle\Entity\Cours $idCoursRdv = null)
{
    return $this->idCoursRdv = $idCoursRdv;
}

/**
 * Get idCoursRdv
 *
 * @return \L3L2\EntraideBundle\Entity\Cours 
 */
public function getIdCoursRdv()
{
    return $this->idCoursRdv;
}

/**
 * Set date
 *
 * @param \DateTime $date
 * @return RendezVous
 */
public function setDate($date)
{
    $this->date = clone $date;

    return $this;
}

/**
 * Get date
 *
 * @return \DateTime 
 */
public function getDate()
{
    return clone $this->date;
}

/**
 * Set time
 *
 * @param \DateTime $time
 * @return RendezVous
 */
public function setTime($time)
{
    $this->time = clone $time;

    return $this;
}

/**
 * Get time
 *
 * @return \DateTime 
 */
public function getTime()
{
    return clone $this->time;
}

/**
 * Set vuEleve
 *
 * @param string $vuEleve
 * @return RendezVous
 */
public function setVuEleve($vuEleve)
{
    $this->vuEleve = $vuEleve;

    return $this;
}

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

/**
 * Set vuProf
 *
 * @param string $vuProf
 * @return RendezVous
 */
public function setVuProf($vuProf)
{
    $this->vuProf = $vuProf;

    return $this;
}

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

/**
 * Set datetimeDebut
 *
 * @param \DateTime $datetimeDebut
 * @return RendezVous
 */
public function setDatetimeDebut($datetimeDebut)
{
    $this->datetimeDebut = $datetimeDebut;

    return $this;
}

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

/**
 * Set datetimeFin
 *
 * @param \DateTime $datetimeFin
 * @return RendezVous
 */
public function setDatetimeFin($datetimeFin)
{
    $this->datetimeFin = $datetimeFin;

    return $this;
}

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



/**
 * Set dernierModif
 *
 * @param \L3L2\UserBundle\Entity\User $dernierModif
 * @return RendezVous
 */
public function setDernierModif(\L3L2\UserBundle\Entity\User $dernierModif = null)
{
    $this->dernierModif = $dernierModif;

    return $this;
}

/**
 * Get dernierModif
 *
 * @return \L3L2\UserBundle\Entity\User 
 */
public function getDernierModif()
{
    return $this->dernierModif;
}
}

如果我在$ idDispoProf之前删除$ idDispoProf或注释我可以架构:更新... 有什么想法吗?

1 个答案:

答案 0 :(得分:2)

您在此特定属性中使用小写字母ManytoOne而在其余属性中使用ManyToOne。 Autoloader在Windows中工作可能是因为这个名为ManyToOne.phpManytoOne.php的系统文件是相同的 - Linux是区分大小写的。

为您解决方案:将ManytoOne更改为ManyToOne