public function remove() { StoreProductImage::removeImagesForProduct($this); StoreProductOptionGroup::removeOptionGroupsForProduct($this); StoreProductOptionItem::removeOptionItemsForProduct($this); StoreProductFile::removeFilesForProduct($this); StoreProductGroup::removeGroupsForProduct($this); StoreProductLocation::removeLocationsForProduct($this); StoreProductUserGroup::removeUserGroupsForProduct($this); StoreProductVariation::removeVariationsForProduct($this); $em = Database::get()->getEntityManager(); $em->remove($this); $em->flush(); $page = Page::getByID($this->cID); if (is_object($page)) { $page->delete(); } }