Services/SiteManagementModel.php
public function deleteSites($collection) {
		$timeStamp = time();
		if (!is_array($collection)) {
			return $this->createException('InvalidParameterValueException', 'Invalid parameter value. Parameter must be an array collection', 'E:S:001');
		}
		$countDeleted = 0;
		foreach($collection as $entry){
			if($entry instanceof BundleEntity\Site){
				$this->em->remove($entry);
				$countDeleted++;
			}
			else{
				$response = $this->getSite($entry);
				if(!$response->error->exists){
					$entry = $response->result->set;
					$this->em->remove($entry);
					$countDeleted++;
				}
			}
		}
		if($countDeleted < 0){
			return new ModelResponse(null, 0, 0, null, true, 'E:E:001', 'Unable to delete all or some of the selected entries.', $timeStamp, time());
		}
		$this->em->flush();

		return new ModelResponse(null, 0, 0, null, false, 'S:D:001', 'Selected entries have been successfully removed from database.', $timeStamp, time());
	}
public function deleteSites($collection) {
		$timeStamp = time();
		if (!is_array($collection)) {
			return $this->createException('InvalidParameterValueException', 'Invalid parameter value. Parameter must be an array collection', 'E:S:001');
		}
		$countDeleted = 0;
		foreach($collection as $entry){
			if($entry instanceof BundleEntity\Site){
				$this->em->remove($entry);
				$countDeleted++;
			}
			else{
				$response = $this->getSite($entry);
				if(!$response->error->exists){
					$entry = $response->result->set;
					$this->em->remove($entry);
					$countDeleted++;
				}
			}
		}
		if($countDeleted < 0){
			return new ModelResponse(null, 0, 0, null, true, 'E:E:001', 'Unable to delete all or some of the selected entries.', $timeStamp, time());
		}
		$this->em->flush();

		return new ModelResponse(null, 0, 0, null, false, 'S:D:001', 'Selected entries have been successfully removed from database.', $timeStamp, time());
	}
public function deleteSites ( $ collection ) { $ timeStamp = time ( ) ; if ( ! is_array ( $ collection ) ) { return $ this -> createException ( 'InvalidParameterValueException' , 'Invalid parameter value. Parameter must be an array collection' , 'E:S:001' ) ; } $ countDeleted = 0 ; foreach ( $ collection as $ entry ) { if ( $ entry instanceof BundleEntity \ Site ) { $ this -> em -> remove ( $ entry ) ; $ countDeleted ++ ; } else { $ response = $ this -> getSite ( $ entry ) ; if ( ! $ response -> error -> exists ) { $ entry = $ response -> result -> set ; $ this -> em -> remove ( $ entry ) ; $ countDeleted ++ ; } } } if ( $ countDeleted < 0 ) { return new ModelResponse ( null , 0 , 0 , null , true , 'E:E:001' , 'Unable to delete all or some of the selected entries.' , $ timeStamp , time ( ) ) ; } $ this -> em -> flush ( ) ; return new ModelResponse ( null , 0 , 0 , null , false , 'S:D:001' , 'Selected entries have been successfully removed from database.' , $ timeStamp , time ( ) ) ; }
@name 			deleteSites()

@since			1.0.0
@version         1.0.8

@author          Can Berkol

@use             $this->createException()

@param           array           $collection

@return          \BiberLtd\Bundle\CoreBundle\Responses\ModelResponse
@name deleteSites ()