Saves a Profile.
Profile $profile A Profile instance:
Boolean Write operation successful
Overrides ProfilerStorageInterface::write
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(),
);
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 WHERE token = :token', $args);
}
else {
$this
->exec($db, 'INSERT INTO sf_profiler_data (token, parent, data, ip, method, url, time, created_at) VALUES (:token, :parent, :data, :ip, :method, :url, :time, :created_at)', $args);
}
$this
->cleanup();
$status = true;
} catch (\Exception $e) {
$status = false;
}
$this
->close($db);
return $status;
}