0
私は2つのエンティティ間のManyToOne
関係の作成に苦労しています。ドキュメントによれば、このMyコードは、有効なManyToOne関係を作成するのに十分でなければなりませんが、以下で説明するエラーが続きます。私は明白な何かを見逃すはずですが、私はそれが何であるか分かりません。Doctrine MappingException ManyToOneの関係
プロジェクトには多くのRemoteVotesがあります。
アプリケーションがスローするエラーは、次のとおり
Doctrine\ORM\Mapping\MappingException
The target-entity App\Model\RemoteVote cannot be found in 'App\Model\Project#remoteVotes'.
RemoteVote.phpモデルの関連部分:
namespace App\Model;
/**
* @ORM\Entity
* @ORM\Table(name="remote_votes")
*/
class RemoteVote extends BaseEntity {
...
/**
* @ORM\ManyToOne(targetEntity="Project", inversedBy="remoteVotes")
* @ORM\JoinColumn(name="project_id", referencedColumnName="id")
*/
protected $project;
...
Project.phpモデルの関連ビット:
namespace App\Model;
/**
* @ORM\Entity
* @ORM\Table(name="projects")
*/
class Project extends BaseEntity
{
public function __construct()
{
$this->remoteVotes = new ArrayCollection();
}
...
/**
* @ORM\OneToMany(targetEntity="RemoteVote", mappedBy="project", cascade={"persist"})
*/
protected $remoteVotes;
...
おかげで前進。