/** * @depends testCreation * @param \Application\AppointmentItem $app * @return \Application\AppointmentItem */ public function testArrayFunctions(\Application\AppointmentItem $app) { $arr = $app->toArray(); $subset = array_merge(array(), self::$arrayToTest); $this->assertArraySubset($subset, $arr); return $app; }
public function save(\Application\AppointmentItem $app, \Core\Database $db) { $fields_to_save = $app->toArray(); unset($fields_to_save['id']); unset($fields_to_save['submitted']); if (is_null($app->getId()) || $app->getId() == '') { $this->makeInsertQuery('appointments', $fields_to_save, $db); $lid = $db->getLastInsertId(); $app->fromArray(array($app->getIdFieldName() => $lid)); } else { $this->makeUpdateQuery('appointments', $fields_to_save, array('id' => $app->getId()), $db); } }