I suggest you to use the maker
component to create your entities (composer require maker --dev
). Also, the integration of Doctrine with Symfony is described here.
FIRST
bin/console make:entity Student # then just answer the question
bin/console make:entity ClassRoom # or anything different than "Class" as it looks like the "class" keyword
bin/console make:entity Course
bin/console make:entity Grades
When creating the Grades
entity, choose the type ManyToOne
(or OneToOne
, can't guess with your description) for your three properties student
, course
and classRoom
.
More information about association mapping here.
NEXT
Then open your entities and enhance your @Column
and @ManyToOne
annotations.
Considers adding a @UniqueConstraint
on the Grade
entity wrapping your three properties if needed.
Considers adding a @JoinColumn
constraint under your three Grade
properties.
FINALLY
bin/console make:migration
bin/console doctrine:migrations:migrate