Exemplo n.º 1
0
 /**
  * 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->aCategory) {
         $this->aCategory->removeProduct($this);
     }
     if (null !== $this->aProvider) {
         $this->aProvider->removeProduct($this);
     }
     if (null !== $this->aUnit) {
         $this->aUnit->removeProduct($this);
     }
     if (null !== $this->aFile) {
         $this->aFile->removeProduct($this);
     }
     if (null !== $this->aResource) {
         $this->aResource->removeProduct($this);
     }
     $this->product_id = null;
     $this->resource_id = null;
     $this->product_name = null;
     $this->product_description = null;
     $this->category_id = null;
     $this->provider_id = null;
     $this->unit_id = null;
     $this->product_range = null;
     $this->product_price = null;
     $this->product_is_active = null;
     $this->product_pic = null;
     $this->created_at = null;
     $this->updated_at = null;
     $this->alreadyInSave = false;
     $this->clearAllReferences();
     $this->resetModified();
     $this->setNew(true);
     $this->setDeleted(false);
 }