2. Tracking Entities

2.1. Simple Track

<?php

// Get an entity
$post = $repository->find(5);

// Track it
$this->get('symedit_analytics.tracker')->track($post);

2.2. Delayed Flush

Entities that are tracked are flushed from Doctrine during the Kernel::TERMINATE event. This allows your application to return the response to the user as quickly as possible without having to wait on the database.