/**
	 * 
	 */private function setClickBanner($id) {
		$banner=$this->getDoctrine()
		->getRepository("BannerBundle:Banner")
		->find($id);
		
		$formData=new Formdata();
		$banner->setClicks($banner->getClicks()+1);
		$formData->updateData($this);
	}
Пример #2
0
 private function setRatedAds($idAds,$rated){
 	$formData=new Formdata();
 	$ad=$this->getDoctrine()
 	->getRepository("AdsmanagerBundle:AdsmanagerAds")
 	->find($idAds);
 	
 	$ad->setRated($rated);
 	$formData->updateData($this);
 	
 }
  public function deleteProductAdsAction($id,Request $request)
  {
  	if(!$this->container->get('security.context')->isGranted('IS_AUTHENTICATED_FULLY') ){
  		return $this->redirectToRoute('fos_user_security_login');
  	}
  	 
  	$adProduct=$this->getDoctrine()
  	->getRepository("AdsmanagerBundle:AdsmanagerProduct")
  	->find($id);
  	 
  	if(!$adProduct){
  		return $this->redirectToRoute('my_ads');
  	}
  	
  	$ad=$this->getDoctrine()
  	->getRepository("AdsmanagerBundle:AdsmanagerAds")
  	->find($adProduct->getIdAd());
  	 
  	if(!$this->isAnUserOwner ( $ad->getUserId() )){
  		return $this->redirectToRoute('my_ads');
  	}
  	
  	$formData=new Formdata();
  	$message=new Message();
  	$document = new Document();
  	$document->deleteFile("/images/ids/".$adProduct->getIdAd()."/".$adProduct->getImages());
  	$formData->deleteData($this,$adProduct);
  	
  	$message->setSuccessMessages("El Producto o Servicio ha sido Eliminado Exitosamente.")->show($this);
  	
  	return $this->redirectToRoute('my_ads');
 	
  }