protected function processForm(sfWebRequest $request, sfForm $form) { $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName())); if ($form->isValid()) { $this->getUser()->setFlash('notice', $form->getObject()->isNew() ? 'The item was created successfully.' : 'The item was updated successfully.'); $new = !$form->getObject()->exists(); $site = $form->save(); if ($new) { $dispatcher = $this->getContext()->getEventDispatcher(); $formatter = new sfFormatter(); chdir(sfConfig::get('sf_root_dir')); $task = new sfGenerateAppTask($dispatcher, $formatter); $task->run(array($site->slug)); $task = new sfSympalEnableForAppTask($dispatcher, $formatter); $task->run(array($site->slug)); $task = new sfSympalCreateSiteTask($dispatcher, $formatter); $task->run(array($site->slug), array('no-confirmation')); $site = Doctrine_Core::getTable('sfSympalSite')->findOneByTitle($site->title); } $this->dispatcher->notify(new sfEvent($this, 'admin.save_object', array('object' => $site))); if ($request->hasParameter('_save_and_add')) { $this->getUser()->setFlash('notice', $this->getUser()->getFlash('notice') . ' You can add another one below.'); $this->redirect('@sympal_sites_new'); } else { $this->redirect('@sympal_sites_edit?id=' . $site->getId()); } } else { $this->getUser()->setFlash('error', 'The item has not been saved due to some errors.', false); } }
private function _createSite() { $siteManager = $this->_sympalContext->getService('site_manager'); chdir(sfConfig::get('sf_root_dir')); $task = new sfSympalCreateSiteTask($this->_dispatcher, new sfFormatter()); $task->run(array($siteManager->getSiteSlug()), array('no-confirmation' => true)); }
protected function _createSite() { chdir(sfConfig::get('sf_root_dir')); $task = new sfSympalCreateSiteTask($this->_dispatcher, $this->_formatter); $task->run(array($this->_application), array('no-confirmation' => true)); }
protected function _createSite() { chdir(sfConfig::get('sf_root_dir')); $task = new sfSympalCreateSiteTask($this->_dispatcher, $this->_formatter); $this->logTaskCall('configure', 'Configuring app for sympal', sprintf('sympal:create-site %s', $this->_application)); $task->run(array($this->_application), array('no-confirmation' => true)); $this->logSection('configure', '...finished configuration application'); }