Beispiel #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->aCategories) {
         $this->aCategories->removeItems($this);
     }
     if (null !== $this->aSubcategories) {
         $this->aSubcategories->removeItems($this);
     }
     if (null !== $this->aUser) {
         $this->aUser->removeItems($this);
     }
     $this->item_id = null;
     $this->category_id = null;
     $this->user_id = null;
     $this->item_name = null;
     $this->price = null;
     $this->description = null;
     $this->date_added = null;
     $this->date_sold = null;
     $this->subcategory_id = null;
     $this->image_url = null;
     $this->alreadyInSave = false;
     $this->clearAllReferences();
     $this->applyDefaultValues();
     $this->resetModified();
     $this->setNew(true);
     $this->setDeleted(false);
 }