Ejemplo n.º 1
0
 public function createBySociete(Societe $societe, \DateTime $dateCreation = null, Etablissement $etablissement = null)
 {
     if (!$dateCreation) {
         $dateCreation = new \DateTime();
     }
     $contrat = new Contrat();
     $contrat->setSociete($societe);
     $contrat->setDateCreation($dateCreation);
     $contrat->setStatut(self::STATUT_BROUILLON);
     $contrat->addPrestation(new Prestation());
     $contrat->addProduit(new Produit());
     if ($etablissement) {
         $contrat->addEtablissement($etablissement);
     } else {
         $contrat->addEtablissement($societe->getEtablissements()->first());
     }
     return $contrat;
 }