예제 #1
0
파일: Country.php 프로젝트: skukit/mobac
 /**
  * Removes document.
  *
  * @return Result
  */
 public function delete()
 {
     if ($this->hasStores() === true) {
         return (new Result())->setError(Result::ERROR_CANNOT_DELETE_RECORD, 'Country has related stores');
     }
     return parent::delete();
 }
예제 #2
0
파일: Vendor.php 프로젝트: skukit/mobac
 /**
  * Deletes record from collection.
  *
  * @return Result
  */
 public function delete()
 {
     if ($this->existsInProducts() === true) {
         return (new Result())->setError(Result::ERROR_CANNOT_UPDATE_RECORD, 'Vendor has related products');
     }
     return parent::delete();
 }
예제 #3
0
파일: Permission.php 프로젝트: skukit/mobac
 /**
  * Removes document.
  *
  * @return Result
  */
 public function delete()
 {
     $existsInUseRoles = (bool) $this->getClient()->getCollection('User')->countByAttributes(['permissions' => ['$in' => [$this->getId()]]]);
     if ($existsInUseRoles) {
         return (new Result())->setError(Result::ERROR_CANNOT_DELETE_RECORD, 'Some users still use this role');
     }
     return parent::delete();
 }
예제 #4
0
 /**
  * Removes document.
  *
  * @return Result
  */
 public function delete()
 {
     $hasUnsentLetters = (bool) $this->getClient()->getCollection('Letter')->countByAttributes(['letter_template_id' => $this->getId()]);
     if ($hasUnsentLetters) {
         return (new Result())->setError(Result::ERROR_CANNOT_DELETE_RECORD, 'Template has related unsent letters');
     }
     return parent::delete();
 }
예제 #5
0
파일: Measure.php 프로젝트: skukit/mobac
 /**
  * Removes document.
  *
  * @return Result
  */
 public function delete()
 {
     $existsInUnitCollection = (bool) $this->getClient()->getCollection('Unit')->countByAttributes(['measure_id' => $this->getId()]);
     if ($existsInUnitCollection) {
         return (new Result())->setError(Result::ERROR_CANNOT_DELETE_RECORD, 'Measure has related units');
     }
     return parent::delete();
 }
예제 #6
0
파일: Property.php 프로젝트: skukit/mobac
 /**
  * Deletes record from collection.
  *
  * @return Result
  */
 public function delete()
 {
     $result = new Result();
     if ($this->existsInProductCharacteristics() === true) {
         return $result->setError(Result::ERROR_CANNOT_UPDATE_RECORD, 'Property present in product specifications');
     }
     if ($this->existsInCategoryCollection() === true) {
         return $result->setError(Result::ERROR_CANNOT_UPDATE_RECORD, 'Property present in category collection');
     }
     return parent::delete();
 }