コード例 #1
0
$author->setOrderBy(1);
$author->save();
$t->info('ML Duchesne as Author associated');
$catpeo = Doctrine::getTable('CataloguePeople')->findForTableByType('taxonomy', $taxon->getId());
$t->is(count($catpeo['author']), 2, 'With author key: "2" record.');
$t->is($catpeo['author'][0]->getPeople()->getGivenName(), 'Poilux', 'Type author and first person well associated to "Poilux"');
$t->is($catpeo['author'][1]->getPeople()->getGivenName(), 'ML', 'Type author and second person well associated to "ML"');
$t->info('Interverting order of "Poilux Duchesne" and "ML Duchesne"');
$catpeo = Doctrine_Query::create()->from('CataloguePeople c')->orderBy('referenced_relation ASC, order_by ASC, id ASC')->execute();
Doctrine::getTable('CataloguePeople')->changeOrder($catpeo[1]->getReferencedRelation(), $catpeo[1]->getRecordId(), 'author', array($catpeo[3]->getId(), $catpeo[1]->getId()));
$catpeo = Doctrine::getTable('CataloguePeople')->findForTableByType('taxonomy', $taxon->getId());
$t->is($catpeo['author'][0]->getPeople()->getGivenName(), 'ML', 'Type author and first person well associated to "ML"');
$t->is($catpeo['author'][1]->getPeople()->getGivenName(), 'Poilux', 'Type author and second person well associated to "Poilux"');
$t->info('Testing the getPeopleRelated method');
$specimen = Doctrine::getTable('Specimens')->findOneByTaxonRef($taxon->getId());
$identification = new Identifications();
$identification->setReferencedRelation('specimens');
$identification->setRecordId($specimen->getId());
$identification->setNotionConcerned('taxonomy');
$identification->setValueDefined('Joli Test');
$identification->save();
$identifier = new CataloguePeople();
$identifier->setReferencedRelation('identifications');
$identifier->setRecordId($identification->getId());
$identifier->setPeopleRef($person1->getId());
$identifier->setPeopleType('identifier');
$identifier->save();
$identifiers = Doctrine::getTable('CataloguePeople')->getPeopleRelated('identifications', 'identifier', $identification->getId());
$t->is($identifiers->count(), 1, '"One" identifier effectively created');
$t->is($identifiers[0]->getPeopleType(), 'identifier', 'New person created in catalogue people is well "identifier"');
$t->is($identifiers[0]->getPeople()->getGivenName(), 'Poilux', '"Poilux" is well the identifier created');