public function executeDelete() { $researcher = ResearcherPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($researcher); $researcher->delete(); return $this->redirect('researcher/list'); }
public function test_delete_ok() { $oldCount = ResearcherPeer::doCount(new Criteria()); $this->goto_edit(); $this->b->click('delete')->isRedirected()->followRedirect()->checkResponseElement('body', '/Researchers/')->checkResponseElement('body', '!/' . $this->Researchers['r1']['name'] . '/'); $this->b->test()->is($oldCount - 1, ResearcherPeer::doCount(new Criteria()), "Researcher count should still be one less than {$oldCount}"); }
public function test_create_fails() { $oldCount = ResearcherPeer::doCount(new Criteria()); $this->b->get('/researcher/list')->checkResponseElement('body', '/Researcher/')->checkResponseElement('body', '/Name/'); $this->b->click('Create Researcher')->checkResponseElement('body', '/Create Researcher/'); $this->b->click('save')->checkResponseElement('body', '/Create Researcher/')->checkResponseElement('body', '/The name field cannot be left blank/'); $this->b->click('save', array('name' => 'Kenglish'))->checkResponseElement('body', '/Create Researcher/')->checkResponseElement('body', '/The organization field cannot be left blank/'); $this->b->test()->is($oldCount, ResearcherPeer::doCount(new Criteria()), "Researcher count should still be {$oldCount}"); }
public function test_create_ok() { $oldCount = ResearcherPeer::doCount(new Criteria()); $organizations = OrganizationPeer::doSelect(new Criteria()); $organization = $organizations[0]; $this->b->test()->ok($organization->getId(), "Should get organization " . $organization->getId()); $this->b->get('/researcher/list')->checkResponseElement('body', '/Researcher/')->checkResponseElement('body', '/Name/'); $this->b->click('Create Researcher')->checkResponseElement('body', '/Create Researcher/'); $this->b->click('save', array('name' => 'Kenglish', 'organization_id' => $organization->getId()))->isRedirected()->followRedirect()->checkResponseElement('body', '/View Researcher/')->checkResponseElement('body', '/Kenglish/'); $this->b->test()->is($oldCount + 1, ResearcherPeer::doCount(new Criteria()), "Researcher count should still be {$oldCount}"); }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = ResearcherPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setOrganizationId($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setName($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setEmail($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setPictureLink($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setBioStatement($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setCreatedAt($arr[$keys[6]]); } }
public function countResearchers($criteria = null, $distinct = false, $con = null) { include_once 'lib/model/om/BaseResearcherPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } $criteria->add(ResearcherPeer::ORGANIZATION_ID, $this->getId()); return ResearcherPeer::doCount($criteria, $distinct, $con); }
public static function retrieveByPKs($pks, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(); $criteria->add(ResearcherPeer::ID, $pks, Criteria::IN); $objs = ResearcherPeer::doSelect($criteria, $con); } return $objs; }