0
を持つエンティティを生成します。symfonyの3ドクトリンのMySQL - 3つのコマンドの実行後に、symfonyの3ドキュメントに従って@ORM注釈
// src/Acme/BlogBundle/Entity/BlogComment.php
namespace Acme\BlogBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Acme\BlogBundle\Entity\BlogComment
*
* @ORM\Table(name="blog_comment")
* @ORM\Entity
*/
class BlogComment
{
/**
* @var integer $id
*
* @ORM\Column(name="id", type="bigint")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string $author
*
* @ORM\Column(name="author", type="string", length=100, nullable=false)
*/
private $author;
.....
残念ながら代わりに:
php bin/console doctrine:mapping:import --force AcmeBlogBundle xml
php bin/console doctrine:mapping:convert annotation ./src
php bin/console doctrine:generate:entities AcmeBlogBundle
を私のような何かの結果を取得する必要がありますgetterとsetterを使って大まかにマッピングされたクラスを取得します。
<?php
namespace Clashers\PanelBundle\Entity;
/**
* Users
*/
class Users
{
/**
* @var string
*/
private $username;
/**
* Set username
*
* @param string $username
*
* @return Users
*/
public function setUsername($username)
{
$this->username = $username;
return $this;
}
/**
* Get username
*
* @return string
*/
public function getUsername()
{
return $this->username;
}
あなたそのような問題に直面しており、DB型、列にすべてのプロパティを手動で割り当てる必要はありません。 これらのエンティティを正しく生成するのに欠けているDoctrineの設定はありますか?
これらを順不同で実行している可能性はありますか?生成されたXMLマッピングファイルとエンティティファイルを削除して再試行することを検討してください。 – Cerad
データベースのUsersテーブルを確認しましたか?あなたのテーブル構造を反映する必要があります。あなたがテーブルが正しく設定されていない場合、その理由が考えられます。 – Sarcoma
あなたは間違いなく生成されたXMLマッピングファイルを削除する必要があります。 – Sarcoma