help~input some student and output 1 teacher,how to do it?(input some id ,output 1 id)

it is about manyToMany.

some students have one teacher, some teachers have one student.

I have 3 forms:studens,studensteachers and teachers,like robot,robotparts,parts. If i want find the only one teacher of 3 students called jack,bob,and michael ,and their ID in studens_teachers are 1,2 and 3.Can i do this? :


if not,how ?

edited Mar '15

thank you,but the two links doesn't had any answer for itself or my question...

Here are a couple of links which might help you:

edited Mar '15


you may use query bulder:

$teachers = $this->modelsManager->createBuilder()
     ->where('student_id = 1')
     ->andWhere('student_id = 2');

btw, I'm not sure that you will get an unique record with the kind of relations you are using ...