/**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeAdd(sfWebRequest $request)
 {
     if ($this->getUser()->isA(Users::REGISTERED_USER)) {
         $this->forwardToSecureAction();
     }
     $this->classification = new ClassificationSynonymies();
     $this->classification->setReferencedRelation($request->getParameter('table'));
     $this->form = new ClassificationSynonymiesForm($this->classification, array('table' => $request->getParameter('table')));
     if ($request->isMethod('post')) {
         $this->form->bind($request->getParameter('classification_synonymies'));
         if ($this->form->isValid()) {
             if ($this->form->getValue('record_id') == $request->getParameter('id')) {
                 $error = new sfValidatorError(new savedValidator(), 'You can\'t synonym yourself!');
                 $this->form->getErrorSchema()->addError($error);
             } else {
                 try {
                     $conn = Doctrine_Manager::connection();
                     $conn->beginTransaction();
                     Doctrine::getTable('ClassificationSynonymies')->mergeSynonyms($request->getParameter('table'), $this->form->getValue('record_id'), $request->getParameter('id'), $this->form->getValue('group_name'));
                     $conn->commit();
                     return $this->renderText('ok');
                 } catch (Doctrine_Exception $e) {
                     $conn->rollback();
                     $error = new sfValidatorError(new savedValidator(), $e->getMessage());
                     $this->form->getErrorSchema()->addError($error);
                 }
             }
         }
     }
     $formFilterName = DarwinTable::getFilterForTable($request->getParameter('table'));
     $this->searchForm = new $formFilterName(array('table' => $request->getParameter('table')));
 }
 public function executeSearch(sfWebRequest $request)
 {
     $this->setCommonValues('catalogue', 'name_indexed', $request);
     $this->forward404Unless($request->hasParameter('searchCatalogue'));
     $item = $request->getParameter('searchCatalogue', array(''));
     $formFilterName = DarwinTable::getFilterForTable($item['table']);
     $this->searchForm = new $formFilterName(array('table' => $item['table'], 'level' => $item['level'], 'caller_id' => $item['caller_id']));
     $this->searchResults($this->searchForm, $request);
     $this->setLayout(false);
 }
<?php

include dirname(__FILE__) . '/../../bootstrap/Doctrine.php';
$t = new lime_test(14, new lime_output_color());
$taxs = Doctrine::getTable('Taxonomy')->findOneByName('Falco Peregrinus eliticus');
$t->info('findWithParents($id)');
$taxa = Doctrine::getTable('Taxonomy')->findWithParents($taxs->getId());
$t->isnt($taxa, null, 'we got a taxa');
$t->is($taxa->count(), 9, 'we got all parent of the taxa');
$t->is($taxa[7]->getId(), $taxs->getParentRef(), 'Parent is correct');
$t->is($taxa[1]->Level->__toString(), 'kingdom', 'get Level');
$t->is($taxs->getNameWithFormat(), '<i>Falco Peregrinus eliticus</i>', 'get Name without extinct');
$taxs->setExtinct('true');
$t->is($taxs->getNameWithFormat(), '<i>Falco Peregrinus eliticus</i> †', 'get Name without extinct');
$t->is(DarwinTable::getFilterForTable('classification_syonymies'), "ClassificationSyonymiesFormFilter", 'Filter Form name');
$t->is(DarwinTable::getFormForTable('classification_syonymies'), "ClassificationSyonymiesForm", 'Form Name');
$t->is(DarwinTable::getModelForTable('classification_syonymies'), "ClassificationSyonymies", 'Model Name');
$t->is(Doctrine::getTable('Taxonomy')->find(4)->toArray(), true, 'We got the record with find');
$t->is(Doctrine::getTable('Taxonomy')->find(-1)->toArray(), true, 'Record bellow 0 are found  with find');
$keywords = Doctrine::getTable('ClassificationKeywords')->findForTable('taxonomy', 4);
$t->is(count($keywords), 0, 'No KW per default');
$kw_full = ClassificationKeywords::getTags('taxonomy');
$avail_kw = array_keys($kw_full);
$kw = new ClassificationKeywords();
$kw->setReferencedRelation('taxonomy');
$kw->setRecordId(4);
$kw->setKeywordType($avail_kw[1]);
$kw->setKeyword('Falco Peregrinus');
$kw->save();
$keywords = Doctrine::getTable('ClassificationKeywords')->findForTable('taxonomy', 4);
$t->is(count($keywords), 1, 'The new Keyword');