私の問題についてはstackoverflowで検索しましたが、私の問題の答えは見つかりませんでした。Symfonyプロダクションマッピング例外FOSUserBundle
現在、PHP 5.6.26 following the documentation on the symfony websiteを実行している私のDebianサーバにsymfonyプロジェクトをデプロイしています。
[Doctrine\ORM\Mapping\MappingException] Class "AppBundle\Entity\User" sub class of "FOS\UserBundle\Model\User" is not a valid entity or mapped super class.
私は私の開発マシンの(Windowsの10でこのエラーを持っていないよ。私は composer install --no-dev --optimize-autoloader
は、私は次のようなエラーにgetコマンドを実行して、私のバンドルをインストールするためのコマンドを実行し
デスクトップとMacBook)
現在私は何が間違っているのか分からない。プロジェクトの後半でアノテーションからymlに切り替えました。
マイUser.php
ファイル:
<?php
namespace AppBundle\Entity;
use FOS\UserBundle\Model\User as BaseUser;
/**
* User
*/
class User extends BaseUser
{
public function __construct()
{
parent::__construct();
}
protected $id;
/**
* @var \AppBundle\Entity\Address
*/
private $address;
/**
* Set address
*
* @param \AppBundle\Entity\Address $address
*
* @return User
*/
public function setAddress(\AppBundle\Entity\Address $address = null)
{
$this->address = $address;
return $this;
}
/**
* Get address
*
* @return \AppBundle\Entity\Address
*/
public function getAddress()
{
return $this->address;
}
}
と私のUser.orm.ymlファイル:
AppBundle\Entity\User:
type: entity
table: user
repositoryClass: AppBundle\Repository\UserRepository
id:
id:
type: integer
id: true
generator:
strategy: AUTO
lifecycleCallbacks: { }
oneToOne:
address:
targetEntity: AppBundle\Entity\Address
cascade: ["persist", "remove"]
にフォルダにリソースを大文字にします。それはうまくいきませんでした – Debreker
私は 'app/AppKernel.php'を編集してFOSUserBundle [ここに記載されている](http://symfony.com/doc/current/bundles/FOSUserBundle/index.html#step -2-enabled-the-bundle)である。そうでなければ、私は他の何かを考えることができません。それはかなりまっすぐ進むはずです。 –
**リソース**フォルダがあなたの答えで大文字になっているのを見ました。私のフォルダリソース(src/AppBundle内)は、これを変更しても、私のプロジェクトは起動しています!ありがとう! – Debreker