/** * @Route("/properties/design", name="properties_design") */ public function designAction(Request $request) { $mls_id = $request->get('mls_id'); $property_id = $request->get('property_id'); $user = $this->getUser(); //Design a property from MLS if ($mls_id) { $mls_property = $this->getBusiness()->getMlsProperty($mls_id); $new_property = new Property($user); $property = $this->getBusiness()->propertyApiMapper($mls_property, $new_property); $property_id = $property->getId(); return $this->redirectToRoute('properties_design', array('property_id' => $property_id)); } else { if ($property_id) { $property = $this->getDoctrine()->getRepository('DashboardBundle:Property')->find($property_id); } else { $property = new Property($user); $property->setName('New Property'); $this->getBusiness()->saveProperty($property); $property_id = $property->getId(); return $this->redirectToRoute('properties_design', array('property_id' => $property_id)); } } $property_form = $this->createForm(PropertyType::class, $property); $property_photo_form = $this->createForm(PropertyPhotoType::class, new PropertyPhoto($property)); return $this->render('DashboardBundle:Properties:design.html.twig', array('mls_id' => $mls_id, 'property_id' => $property_id, 'property' => $property, 'property_form' => $property_form->createView(), 'property_photo_form' => $property_photo_form->createView())); }
public function removePhoto(Property $property, $photo_id) { $cloudinaryApi = $this->container->get('speicher210_cloudinary.api'); foreach ($property->getPhotos() as $photo) { if ($photo->getPhotoId() == $photo_id) { $this->getEM()->remove($photo); $this->getEM()->flush(); $cloudinaryApi->delete_resources(array($photo_id)); break; } } }
public function __construct(User $user, Property $property, Template $template) { $this->user = $user; $this->creation_date = new \DateTime(); $this->modification_date = $this->creation_date; $this->property = $property; $this->template = $template; $this->total_sent = 0; //Binding Flyer with Property $this->email = $user->getProfile()->getEmail(); $this->sender_name = $user->getProfile()->getFullName(); $this->email_reply = $user->getProfile()->getEmail(); $this->address = $property->getAddress(); $this->map_active = true; $this->lat = $property->getLat(); $this->lng = $property->getLng(); $this->map_zoom = $property->getMapZoom(); $this->map_center_lat = $property->getMapCenterLat(); $this->map_center_lng = $property->getMapCenterLng(); }