/** * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). */ public function clear() { if (null !== $this->aProduct) { $this->aProduct->removeStock($this); } if (null !== $this->aUnit) { $this->aUnit->removeStock($this); } $this->id = null; $this->product_id = null; $this->amount = null; $this->unit_id = null; $this->buy = null; $this->sell_public = null; $this->sell_distributor = null; $this->sell_misc = null; $this->discount = null; $this->unlimited = null; $this->status = null; $this->alreadyInSave = false; $this->clearAllReferences(); $this->resetModified(); $this->setNew(true); $this->setDeleted(false); }