public function PdoProfilerStorage::write in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/http-kernel/Profiler/PdoProfilerStorage.php \Symfony\Component\HttpKernel\Profiler\PdoProfilerStorage::write()
Saves a Profile.
Parameters
Profile $profile A Profile instance:
Return value
bool Write operation successful
Overrides ProfilerStorageInterface::write
File
- vendor/
symfony/ http-kernel/ Profiler/ PdoProfilerStorage.php, line 85
Class
- PdoProfilerStorage
- Base PDO storage for profiling information in a PDO database.
Namespace
Symfony\Component\HttpKernel\ProfilerCode
public function write(Profile $profile) {
$db = $this
->initDb();
$args = array(
':token' => $profile
->getToken(),
':parent' => $profile
->getParentToken(),
':data' => base64_encode(serialize($profile
->getCollectors())),
':ip' => $profile
->getIp(),
':method' => $profile
->getMethod(),
':url' => $profile
->getUrl(),
':time' => $profile
->getTime(),
':created_at' => time(),
':status_code' => $profile
->getStatusCode(),
);
try {
if ($this
->has($profile
->getToken())) {
$this
->exec($db, 'UPDATE sf_profiler_data SET parent = :parent, data = :data, ip = :ip, method = :method, url = :url, time = :time, created_at = :created_at, status_code = :status_code WHERE token = :token', $args);
}
else {
$this
->exec($db, 'INSERT INTO sf_profiler_data (token, parent, data, ip, method, url, time, created_at, status_code) VALUES (:token, :parent, :data, :ip, :method, :url, :time, :created_at, :status_code)', $args);
}
$this
->cleanup();
$status = true;
} catch (\Exception $e) {
$status = false;
}
$this
->close($db);
return $status;
}