<?php $scientist = new Scientist( 'Albert', 'Einstein' ); $scientist->addTheory( new Theory('Theory of relativity') ); EntityManager::persist($scientist); EntityManager::flush();