[Flow] problem with an unidirectional one-to-many relations
Kompaoré Désiré
nkompaore at kode-informatique.com
Wed Jun 19 13:13:36 CEST 2013
Hi,
I have a problem with an unidirectional one-to-many relations in my flow
application.
I've a domain model (Dossier) which contains a manytomany property as
described bellow :
/*
* @Flow\Entity
*/
class Dossier {
/**
* @var
\Doctrine\Common\Collections\Collection<\Kode\Crm\Domain\Model\Client>
* @ORM\ManyToMany
*
@ORM\JoinTable(inverseJoinColumns={@ORM\JoinColumn(unique=true)})
*/
protected $partiesAdverses;
public function __construct() {
$this->partiesAdverses = new
\Doctrine\Common\Collections\ArrayCollection();
}
/**
*
* @param \Kode\Crm\Domain\Model\Client $partieAdverse
* @return void
*/
public function addPartieAdverse(\Kode\Crm\Domain\Model\Client
$partieAdverse) {
$this->partiesAdverses->add($partieAdverse);
}
/**
* Getter for parties adverses
*
* @return
\Doctrine\Common\Collections\Collection<\Kode\Crm\Domain\Model\Client>
*/
public function getPartiesAdverses() {
return $this->partiesAdverses;
}
/**
*
* @param \Kode\Crm\Domain\Model\Client $partieAdverse
* @return void
*/
public function removePartieAdverse(\Kode\Crm\Domain\Model\Client
$partieAdverse) {
$this->partiesAdverses->removeElement($partieAdverse);
}
}
A dossier can have many "partiesAdverses" (which are client) but i don't
want to record the inversed side.
Here is my controller action:
/**
* @param \Kode\Crm\Domain\Model\Dossier $dossier
* @param \Kode\Crm\Domain\Model\Client $client
* @return void
*/
public function
newPartieAdverseAction(\Kode\Crm\Domain\Model\Dossier $dossier,
\Kode\Crm\Domain\Model\Client $client) {
$dossier->addPartieAdverse($client);
$this->dossierRepository->update($dossier);
$this->redirect('index');
}
My problem is that when i create a newPartieAdverse, nothing is
persisted in the created join table
kode_crm_domain_model_dossier_partiesadverses_join
Is it the right way to do the stuff?
Thank's in advance
Regards
Désiré Kompaoré
More information about the Flow
mailing list