Exemple #1
0
 public function executeCreate(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod(sfRequest::POST));
     $this->checkProject($request);
     $this->checkProfile($request, $this->ei_project);
     $this->checkSubject($request, $this->ei_project);
     $subject_has_campaign = new EiSubjectHasCampaign();
     $subject_has_campaign->setSubjectId($this->ei_subject->getId());
     $ei_campaign = new EiCampaign();
     $ei_campaign->setProjectId($this->ei_project->getProjectId());
     $ei_campaign->setProjectRef($this->ei_project->getRefId());
     $ei_campaign->setAuthorId($this->getUser()->getGuardUser()->getId());
     $subject_has_campaign->setEiCampaign($ei_campaign);
     $this->form = new EiSubjectHasCampaignForm($subject_has_campaign);
     $this->form->embedForm('ei_subject_campaign', new EiCampaignForm($ei_campaign));
     $this->processForm($request, $this->form);
     $this->setTemplate('new');
 }
 public function createDefaultTnr(Doctrine_Connection $conn = null)
 {
     if ($conn == null) {
         $conn = Doctrine_Manager::connection();
     }
     $guard = sfContext::getInstance()->getUser()->getGuardUser();
     $default_tnr = new EiCampaign(null, null, $this->getEiProject());
     $default_tnr->setName('ValidationTests_S' . $this->getId());
     $default_tnr->setAuthorId($guard->getId());
     $default_tnr->save($conn);
     //Association du tnr par défaut au bug
     $default_tnr_relation = new EiSubjectHasCampaign(null, null, $this, $default_tnr);
     $default_tnr_relation->setIsTnr(true);
     $default_tnr_relation->save($conn);
 }