/** * {@inheritdoc} */ public function write(Profile $profile) { $db = $this->initDb(); $args = array(':token' => $profile->getToken(), ':parent' => $profile->getParent() ? $profile->getParent()->getToken() : '', ':data' => base64_encode(serialize($profile->getCollectors())), ':ip' => $profile->getIp(), ':url' => $profile->getUrl(), ':time' => $profile->getTime(), ':created_at' => time()); try { $this->exec($db, 'INSERT INTO sf_profiler_data (token, parent, data, ip, url, time, created_at) VALUES (:token, :parent, :data, :ip, :url, :time, :created_at)', $args); $this->cleanup(); $status = true; } catch (\Exception $e) { $status = false; } $this->close($db); return $status; }