/** * Checks if an specific Address is contained in a Zone. For an Address, to * be contained in a Zone means that belongs to one (at least) of this Zone * locations. * * @param AddressInterface $address Address * @param ZoneInterface $zone Zone * * @return bool Address is contained in zone */ public function isAddressContainedInZone(AddressInterface $address, ZoneInterface $zone) { $locations = $zone->getLocations(); $cityId = $address->getCity(); $found = false; try { $found = $this->locationProvider->in($cityId, $locations); } catch (Exception $e) { // Silent pass } return $found; }
/** * Checks if the first received id is contained between the rest of ids * received as second parameter. * * @return Response Data serialized in json */ public function inAction() { $id = $this->request->query->get('id'); $ids = explode(',', $this->request->query->get('ids')); $result = $this->locationProvider->in($id, $ids); return $this->createResponseObject(function () use($result) { return ['result' => $result]; }); }
/** * Test in with a non-existent location */ public function testInLocationNotFound() { $this->setExpectedException('Doctrine\\ORM\\EntityNotFoundException'); $this->locationProviderAdapter->in('UNEXISTENT', ['ES_CA_VO_SantCeloni', 'ES_CA']); }