/**
* @param \Sokil\Mongo\Collection $collection instance of Mongo collection
* @param array $data mongo document
* @param array $options options of object initialization
*/
public function __construct(Collection $collection, array $data = null, array $options = array())
{
// lisk to collection
$this->collection = $collection;
// configure document with options
$this->options = $options;
// init document
$this->initDelegates();
// execute before construct callable
$this->beforeConstruct();
// initialize with data
parent::__construct($data, $this->getOption('stored'));
// use versioning
if ($this->getOption('versioning')) {
$this->getRevisionManager()->listen();
}
// execure after construct event handlers
$this->eventDispatcher->dispatch('afterConstruct');
}