The first entity called BUNDLE
/**
* @var \Doctrine\Common\Collections\Collection of \Akademie\Course\Course
* @ManyToMany(targetEntity="Akademie\Course\Course", mappedBy="bundles")
*/
private $courses;
The second entity is called COURSE
/**
* @var \Doctrine\Common\Collections\Collection of \Akademie\Bundle\Bundle
* @ManyToMany(targetEntity="Akademie\Bundle\Bundle", inversedBy="courses")
*/
private $bundles;
/**
* @var \Doctrine\Common\Collections\Collection of \Akademie\Course\CourseDate
* @OneToMany(targetEntity="Akademie\Course\CourseDate", mappedBy="course")
*/
private $courseDates;
/**
* @var int
* @Column(type="boolean")
*/
private $hidden;
and the third is called COURSEDATE
/**
* @var \Akademie\Course\Course
* @ManyToOne(targetEntity="Akademie\Course\Course", inversedBy="courseDates")
* @JoinColumn(nullable=false)
*/
private $course;
/**
* @var \DateTime
* @Column(type="datetimetz", nullable=true)
*/
private $beginDate;
I have parameter course
and I need to get all bundles
, which contains this course
. What's more, all other courses
in that bundle
has to have courseDate
newer than current date and can't be hidden. Otherwise I don't want to get this bundle. I hope it is clear now...
I am not familiar with
MEMBER OF
but i think you are better of with anINNER JOIN
.DQL:
QueryBuilder:
I assumed that your person entity has an attribute called
hidden
and that your person-city relationship is bidirectional.