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