新しいエンティティがDoctrine2によってデータベースに追加されていないので、私のコードで何が間違っているのだろうと思いました。スキーマ:Doctrineはデータベースに新しいエンティティを追加していません
教義実行した後
--force更新を私が返さ以下の抱えている:
教義:スキーマ:--dump-SQLの更新更新する 何も - データベースは、現在のエンティティメタデータとすでに同期しています。 doctrine:schema:update --force 更新するものはありません - データベースは、現在のエンティティメタデータとすでに同期しています。ここで
私の新しいエンティティです:
任意の提案:
以下<?php
namespace MainBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Distributor
*
* @ORM\Table(name="distributor")
* @ORM\Entity(repositoryClass="MainBundle\Repository\DistributorRepository")
*/
class Distributor
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="company_name", type="string", length=255, nullable=true, unique=true)
*/
private $companyName;
/**
* @var string
*
* @ORM\Column(name="contact_name", type="string")
*/
private $contactName;
/**
* @var string
*
* @ORM\Column(name="email", type="string", length=255, nullable=true, unique=true)
*/
private $email;
/**
* @var string
*
* @ORM\Column(name="phone", type="string", length=14, nullable=true, unique=true)
*/
private $phone;
/**
* @var \DateTime
*
* @ORM\Column(name="date", type="datetime")
*/
private $date;
/**
* @var string
*
* @ORM\Column(name="message", type="text")
*/
private $message;
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set companyName
*
* @param string $companyName
*
* @return Distributor
*/
public function setCompanyName($companyName)
{
$this->companyName = $companyName;
return $this;
}
/**
* Get companyName
*
* @return string
*/
public function getCompanyName()
{
return $this->companyName;
}
/**
* Set contactName
*
* @param string $contactName
*
* @return Distributor
*/
public function setContactName($contactName)
{
$this->contactName = $contactName;
return $this;
}
/**
* Get contactName
*
* @return string
*/
public function getContactName()
{
return $this->contactName;
}
/**
* Set email
*
* @param string $email
*
* @return Distributor
*/
public function setEmail($email)
{
$this->email = $email;
return $this;
}
/**
* Get email
*
* @return string
*/
public function getEmail()
{
return $this->email;
}
/**
* Set phone
*
* @param string $phone
*
* @return Distributor
*/
public function setPhone($phone)
{
$this->phone = $phone;
return $this;
}
/**
* Get phone
*
* @return string
*/
public function getPhone()
{
return $this->phone;
}
/**
* Set date
*
* @param \DateTime $date
*
* @return Distributor
*/
public function setDate($date)
{
$this->date = $date;
return $this;
}
/**
* Get date
*
* @return \DateTime
*/
public function getDate()
{
return $this->date;
}
/**
* Set message
*
* @param string $message
*
* @return Distributor
*/
public function setMessage($message)
{
$this->message = $message;
return $this;
}
/**
* Get message
*
* @return string
*/
public function getMessage()
{
return $this->message;
}
}
は私のフォルダが編成されている方法は何ですか?前もって感謝します。ここで
は私のプロジェクトでの教義の設定です:
データベースでmysqlコマンドを実行し、 'show tables'を実行すると、' distributor'テーブルはすでに存在していますか? –
@ AlvinBunkあなたの答えをありがとう。いいえ、同じ名前のテーブルはありません。 –
まず、app/consoleのdoctrine:schema:validateを実行してからDoctrine Database Migrations(ドキュメントで推奨)を試してみてください。またはデータベースを再作成して、再度更新を実行してみてください。 – Molarro