/** * Checks wether we are allowed to specify the primary key on a * table with allowPkInsert=true set * * saves the object, gets it from data-source again and then compares * them for equality (thus the instance pool is also checked) */ public function testAllowPkInsertOnIdMethodNativeTable() { CustomerPeer::doDeleteAll(); $cu = new Customer(); $cu->setPrimaryKey(100000); $cu->save(); $this->assertEquals(100000, $cu->getPrimaryKey()); $cu2 = CustomerPeer::retrieveByPk(100000); $this->assertSame($cu, $cu2); }
/** * Executes delete action * * @param sfWebRequest $request */ public function executeDelete(sfWebRequest $request) { $request->checkCSRFProtection(); $this->forward404Unless($customer = CustomerPeer::retrieveByPk($request->getParameter('id')), sprintf('Object customer does not exist (%s).', $request->getParameter('id'))); $customer->delete(); $this->redirect('customer/index'); }