Dê uma olhada na configuração bidirecional OneToMany
http://docs.doctrine-project.org/projects/doctrine-orm/en/2.0.x/reference/association-mapping.html#one-to-many-bidirectional
Aqui está um exemplo usando anotações:
/**
* @Entity
* @Table( name="country" )
*/
class Country
{
/**
* @Id
* @Column(type="integer")
* @GeneratedValue
*/
public $id;
/**
* @Column( type="string", length=30, name="name", nullable=false )
*/
public $name;
/**
* @OneToMany( targetEntity="City", mappedBy="Country" )
*/
private $cities;
}
/**
* @Entity
* @Table( name="city" )
*/
class City
{
/**
* @Id
* @Column(type="integer")
* @GeneratedValue
*/
public $id;
/**
* @ManyToOne( targetEntity="Country" )
* @JoinColumn( name="country", referencedColumnName="id" )
*/
public $country;
/**
* @Column( type="string", length=30, name="name", nullable=false )
*/
public $name;
}
Você precisa configurar isso para permitir o
$country->getCities()
método para trabalhar