public function clear()
{
if ($this->initialized && $this->isEmpty()) {
return;
}
if ($this->mapping !== null && isset($this->mapping['embedded'])) {
foreach ($this->coll as $element) {
$this->dm->getUnitOfWork()->scheduleOrphanRemoval($element);
}
}
$this->coll->clear();
$this->changed();
$this->dm->getUnitOfWork()->scheduleCollectionDeletion($this);
$this->takeSnapshot();
}