Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/269.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Symfony 2:条令实体未更新_Php_Symfony_Doctrine_Entities - Fatal编程技术网

Php Symfony 2:条令实体未更新

Php Symfony 2:条令实体未更新,php,symfony,doctrine,entities,Php,Symfony,Doctrine,Entities,我对Symfony 2.0和doctrine非常陌生。我让generete my entity参考食谱“如何从现有数据库生成实体” 我的关系: 客户有很多付款 向一名客户付款 实体:Client.php <?php namespace Auto\EcoleBundle\Entity; use Doctrine\ORM\Mapping as ORM; /** * Client * * @ORM\Table(nam

我对Symfony 2.0和doctrine非常陌生。我让generete my entity参考食谱“如何从现有数据库生成实体” 我的关系: 客户有很多付款 向一名客户付款

实体:Client.php

<?php

   namespace Auto\EcoleBundle\Entity;

   use Doctrine\ORM\Mapping as ORM;

       /**
        * Client
        *
        * @ORM\Table(name="client", indexes={@ORM\Index(name="fk_client_delegation1_idx", columns={"delegation_id"})})
        * @ORM\Entity
        */
     class Client
       {
        /**
         * @var string
         *
         * @ORM\Column(name="nom", type="string", length=45, nullable=false)
         */


  private $nom;

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

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

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

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

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

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

    /**
     * @var string
     *
     * @ORM\Column(name="code_postal", type="string", length=45, nullable=true)

     */
    private $codePostal;

    /**
     * @var boolean
     *
     * @ORM\Column(name="code", type="boolean", nullable=true)
     */
    private $code;

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

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

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

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

    /**
     * @var \Auto\EcoleBundle\Entity\Delegation
     *
     * @ORM\ManyToOne(targetEntity="Auto\EcoleBundle\Entity\Delegation")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="delegation_id", referencedColumnName="id")
     * })
     */
    private $delegation;

    /**
     * @var \Doctrine\Common\Collections\Collection
     *
     * @ORM\ManyToMany(targetEntity="Auto\EcoleBundle\Entity\ExamenCode", inversedBy="client")
     * @ORM\JoinTable(name="client_has_examen_code",
     *   joinColumns={
     *     @ORM\JoinColumn(name="client_id", referencedColumnName="id")
     *   },
     *   inverseJoinColumns={
     *     @ORM\JoinColumn(name="examen_code_id", referencedColumnName="id")
     *   }
     * )
     */
    private $examenCode;

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->examenCode = new \Doctrine\Common\Collections\ArrayCollection();
    }


    /**
     * Set nom
     *
     * @param string $nom
     * @return Client
     */
    public function setNom($nom)
    {
        $this->nom = $nom;

        return $this;
    }

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

    /**
     * Set dateNais
     *
     * @param \DateTime $dateNais
     * @return Client
     */
    public function setDateNais($dateNais)
    {
        $this->dateNais = $dateNais;

        return $this;
    }

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

    /**
     * Set profession
     *
     * @param string $profession
     * @return Client
     */
    public function setProfession($profession)
    {
        $this->profession = $profession;

        return $this;
    }

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

    /**
     * Set passportNum
     *
     * @param string $passportNum
     * @return Client
     */
    public function setPassportNum($passportNum)
    {
        $this->passportNum = $passportNum;

        return $this;
    }

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

    /**
     * Set cinNum
     *
     * @param string $cinNum
     * @return Client
     */
    public function setCinNum($cinNum)
    {
        $this->cinNum = $cinNum;

        return $this;
    }

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

    /**
     * Set cinDate
     *
     * @param \DateTime $cinDate
     * @return Client
     */
    public function setCinDate($cinDate)
    {
        $this->cinDate = $cinDate;

        return $this;
    }

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

    /**
     * Set adresse
     *
     * @param string $adresse
     * @return Client
     */
    public function setAdresse($adresse)
    {
        $this->adresse = $adresse;

        return $this;
    }

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

    /**
     * Set codePostal
     *
     * @param string $codePostal
     * @return Client
     */
    public function setCodePostal($codePostal)
    {
        $this->codePostal = $codePostal;

        return $this;
    }

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

    /**
     * Set code
     *
     * @param boolean $code
     * @return Client
     */
    public function setCode($code)
    {
        $this->code = $code;

        return $this;
    }

    /**
     * Get code
     *
     * @return boolean 
     */
    public function getCode()
    {
        return $this->code;
    }

    /**
     * Set tel
     *
     * @param string $tel
     * @return Client
     */
    public function setTel($tel)
    {
        $this->tel = $tel;

        return $this;
    }

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

    /**
     * Set fax
     *
     * @param string $fax
     * @return Client
     */
    public function setFax($fax)
    {
        $this->fax = $fax;

        return $this;
    }

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

    /**
     * Set email
     *
     * @param string $email
     * @return Client
     */
    public function setEmail($email)
    {
        $this->email = $email;

        return $this;
    }

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

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

    /**
     * Set delegation
     *
     * @param \Auto\EcoleBundle\Entity\Delegation $delegation
     * @return Client
     */
    public function setDelegation(\Auto\EcoleBundle\Entity\Delegation $delegation = null)
    {
        $this->delegation = $delegation;

        return $this;
    }

    /**
     * Get delegation
     *
     * @return \Auto\EcoleBundle\Entity\Delegation 
     */
    public function getDelegation()
    {
        return $this->delegation;
    }

    /**
     * Add examenCode
     *
     * @param \Auto\EcoleBundle\Entity\ExamenCode $examenCode
     * @return Client
     */
    public function addExamenCode(\Auto\EcoleBundle\Entity\ExamenCode $examenCode)
    {
        $this->examenCode[] = $examenCode;

        return $this;
    }

    /**
     * Remove examenCode
     *
     * @param \Auto\EcoleBundle\Entity\ExamenCode $examenCode
     */
    public function removeExamenCode(\Auto\EcoleBundle\Entity\ExamenCode $examenCode)
    {
        $this->examenCode->removeElement($examenCode);
    }

    /**
     * Get examenCode
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    public function getExamenCode()
    {
        return $this->examenCode;
    }
}
        /**
         * @ORM\OneToMany(targetEntity="Auto\EcoleBundle\Entity\Payement", cascade={"persist", "remove"}, mappedBy="client")
         * 
         */
private $payements;

以及更新Payement.php:

    /**
     * @var \Auto\EcoleBundle\Entity\Client
     *
     * @ORM\ManyToOne(targetEntity="Auto\EcoleBundle\Entity\Client", inversedBy="payements")
     */
    private $client;
然后在运行之后:

php app/console doctrine:generate:entities AutoEcoleBundle:Client
php app/console doctrine:generate:entities AutoEcoleBundle:Payement
更新获取和设置的步骤


但是在客户端类中未生成付款的get和set

您确定这是指向实体的正确路径吗

php app/console doctrine:generate:entities AutoEcoleBundle:Client
php app/console doctrine:generate:entities AutoEcoleBundle:Payement
如果路径不正确,则应该在这些之后出现错误

尝试添加正确的(在文件夹中检查,不确定是否正确):


通过在生成实体之前运行解决

php app/console doctrine:cache:clear-metadata 

任何人都可以解释是什么?

如果我删除所有函数get and set php应用程序/控制台原则:generate:entities Auto\EcoleBundle\Entity\Client生成所有函数只生成付款的get and set,如果我在运行generate entities后重命名或删除culunm,则culunm的旧名称将与函数get and setting一起显示
php app/console doctrine:generate:entities AutoEcoleBundle:Client
php app/console doctrine:generate:entities AutoEcoleBundle:Payement
php app/console doctrine:generate:entities Auto\EcoleBundle\Entity\Client
php app/console doctrine:generate:entities Auto\EcoleBundle\Entity\Payement 
php app/console doctrine:cache:clear-metadata