public function free($deep = false)
{
if ($this->_state != self::STATE_LOCKED && $this->_state != self::STATE_TLOCKED) {
$this->_state = $this->exists() ? self::STATE_LOCKED : self::STATE_TLOCKED;
$this->_table->getRepository()->evict($this->_oid);
$this->_table->removeRecord($this);
$this->_data = array();
$this->_id = array();
if ($deep) {
foreach ($this->_references as $name => $reference) {
if (!$reference instanceof Doctrine_Null) {
$reference->free($deep);
}
}
}
$this->_references = array();
}
}