public function savePropertyAction() { $request = $this->getRequest(); $uType = LeasingUnitTypePeer::getTypeByName($request->request->get('type')); $uLoc = LeasingLocationPeer::getLocationByName($request->request->get('loc')); //Lease Type $lt = json_decode($request->request->get('lease')); if (count($lt > 1)) { $leaseType = 'both'; } else { $leaseType = $lt[0]; } $uLease = LeasingLeaseTypePeer::getLeaseTypeByName($leaseType); $unit = LeasingUnitPeer::getUnitByPostId($request->request->get('post_id')); if (empty($unit)) { $unit = new LeasingUnit(); } $unit->setName($request->request->get('name')); $unit->setPostId($request->request->get('post_id')); $unit->setContent($request->request->get('content')); $unit->setAvailability($request->request->get('avail')); $unit->setPriceRange($request->request->get('price')); $unit->setStatus(C::ACTIVE); $unit->setUnitTypeId($uType->getId()); $unit->setLocationId($uLoc->getId()); $unit->setLeaseTypeId($uLease->getId()); $unit->save(); return new RedirectResponse('http://leasing.dmcihomes.com.local/wp-admin/post.php'); }