나는 doctrine으로 데이터베이스를 관리하려고한다.데이터베이스를 업데이트 할 수 없습니다. symfony php database doctrine
나는 두 개의 엔티티를 가지고 있는데, 나는 3 시간 후에 모드를 추가하는데 성공했다. 내 엔터티 voiture
을 코딩하면베이스가 업데이트되고 변경이 없음을 계속 보여줍니다.
<?php
/**
* Created by PhpStorm.
* User: jamel_pc
* Date: 2016-11-27
* Time: 9:16 PM
*/
namespace ParcBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Class Modele
* @package ParcBundle\Entity
*
* @ORM\Entity
* @ORM\Table(name="Modele")
*/
class Modele{
/**
*@ORM\Id
*@ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string",length=255)
*
*/
private $Libelle;
/**
* @ORM\Column(type="string",length=255)
*/
private $Pays;
/**
* @ORM\Column(type="string",length=255)
*/
/**
* @return mixed
*/
public function getLibelle()
{
return $this->Libelle;
}
/**
* @param mixed $Libelle
*/
public function setLibelle($Libelle)
{
$this->Libelle = $Libelle;
}
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @param mixed $id
*/
public function setId($id)
{
$this->id = $id;
}
/**
* @return mixed
*/
public function getPays()
{
return $this->Pays;
}
/**
* @param mixed $Pays
*/
public function setPays($Pays)
{
$this->Pays = $Pays;
}
}
내 voiture 코드 :
<?php
/**
* Created by PhpStorm.
* User: jamel_pc
* Date: 2016-11-27
* Time: 11:10 PM
*/
/**
* Class voiture
* @package ParcBundle\Entity
*
* @ORM\Entity
* @ORM\Table(name="Voiture")
*/
namespace ParcBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
class voiture
{
/**
*@ORM\Id
*@ORM\Column(type="integer")
*/
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string",length=255)
*
*/
private $Serie;
/**
* @ORM\Column(type="datetime",length=255)
*/
private $DateMiseCirculation;
/**
* @ORM\Column(type="string",length=255)
*/
private $Marque;
/**
* @ORM\ManyToOne(targetEntity="ParcBundle\Entity\Modele")
* @ORM\JoinColumn(name="id", referencedColumnName="id");
*/
private $modele;
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @param mixed $id
*/
public function setId($id)
{
$this->id = $id;
}
/**
* @return mixed
*/
public function getModele()
{
return $this->modele;
}
/**
* @param mixed $modele
*/
public function setModele($id)
{
$this->modele = $modele;
}
/**
* @return mixed
*/
public function getSerie()
{
return $this->Serie;
}
/**
* @param mixed $Serie
*/
public function setSerie($Serie)
{
$this->Serie = $Serie;
}
/**
* @return mixed
*/
public function getDateMiseCirculation()
{
return $this->DateMiseCirculation;
}
/**
* @param mixed $DateMiseCirculation
*/
public function setDateMiseCirculation($DateMiseCirculation)
{
$this->DateMiseCirculation = $DateMiseCirculation;
}
/**
* @return mixed
*/
public function getMarque()
{
return $this->Marque;
}
/**
* @param mixed $Marque
*/
public function setMarque($Marque)
{
$this->Marque = $Marque;
}
}
입니다 오류가 나는 얻을 :
이오류 : 아무것도 업데이트 - 데이터베이스가 이미 없다 현재 엔터티 메타 데이터 과 동기화됩니다.
어쩌면 당신해야 클래스 선언이 아닌 별도의 주석. –
현재 db 스키마는 무엇입니까? – sanandrl
krauze : 나는 별개하지 않아야합니까? 어떻게 ? –