function testToArray() { $info = new VoiceInfo($this->data); $array = $info->toArray(); foreach ($array as $key => $value) { $this->assertSame($value, $this->data[$key]); } }
function handleEdit() { $voiceNew = new VoiceInfo($_REQUEST); $voiceNew->checkDetail(); $imageFile = $_FILES['image_file']; if ($imageFile['size'] > 0) { $imageInfo = $this->imageFile->save($this->userid, $imageFile); $voiceNew->imageid = $imageInfo->imageid; } $this->voiceDb->updateDetail($voiceNew); }
function getPlaying(VoiceInfo $i) { if (!$i->voiceid || !$i->isVisible) { return $i; } $params = array(':vid' => $i->voiceid); $sql = sprintf("SELECT * FROM %s WHERE `voice_id`=:vid LIMIT 1", self::TABLE_PLAYING); $state = $this->pdo->prepare($sql); if (!$state->execute($params)) { return $i; } $array = $state->fetch(PDO::FETCH_ASSOC); $i->copyPlaying($array); return $i; }