私はSymfony 3.2.6/PHP 7.1で動作するmanyToMay双方向マッピングを取得しようとしています。私は、エラーDoctrine manyToMany定義が動作しません未定義インデックス:joinTable
せずに実行する
php bin/console doctrine:schema:update --dump-sql
コマンドを取得することができません[symfonyの\コンポーネント\デバッグ\例外の\ ContextErrorException] お知らせ:未定義のインデックス:joinTable
定義
Busybee\StudentBundle\Entity\Student:
type: entity
table: student
repositoryClass: Busybee\StudentBundle\Repository\StudentRepository
id:
id:
type: integer
id: true
generator:
strategy: AUTO
fields:
startAtSchool:
type: date
manyToMany:
enrolments:
targetEntity: Busybee\StudentBundle\Entity\Enrolment
mappedBy: students
and
Busybee\StudentBundle\Entity\Enrolment:
type: entity
table: enrolment
repositoryClass: Busybee\StudentBundle\Repository\EnrolmentRepository
id:
id:
type: integer
id: true
generator:
strategy: AUTO
fields:
status:
type: string
length: '32'
lastModified:
type: datetime
createdOn:
type: datetime
manyToMany:
students:
targetEntity: Busybee\StudentBundle\Entity\Student
inversedBy: enrolments
Student EntityのmappedByを削除すると、SQLはdoctrine:schema:updateコマンドを使用して生成されます。 http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/association-mapping.html#owning-and-inverse-side-on-a-manytomany-associationの例では、inversedByエンティティのjoinTableインデックスが表示されています。このテーブルまたはmappedByエンティティにjoinTableを追加すると、未定義インデックス:joinTable
何か問題がありますか?これはバグですか?どんな助けでも大歓迎です。
クレイグ
データベースを削除/再作成しましたか?既存のデータベースを持っていて、これらのエンティティの構造を追加/変更した場合は、変更時にバグが発生した可能性があります。これは、最初からやり直すことで修正することができます。明らかに、あなたは生産現場でこれをしたくないでしょう! – ehymel
コメントありがとうございます。はい、すべてのテーブルを削除してもエラーは残ります。 –