コード例 #1
0
 /**
  * Test the in method when the received location is not found.
  */
 public function testInLocationNotFound()
 {
     $locationId = 'id-test';
     $locationSearchIds = ['id-search1', 'id-search2'];
     $this->locationRepository->expects($this->once())->method('findOneBy')->with(['id' => $locationId])->will($this->returnValue(null));
     $this->setExpectedException('Doctrine\\ORM\\EntityNotFoundException');
     $this->locationServiceProviderAdapter->in($locationId, $locationSearchIds);
 }
コード例 #2
0
 /**
  * Get the hierarchy given a location sorted from root to the given
  * location.
  *
  * @param string $id The location id.
  *
  * @return LocationData[] Collection of locations
  *
  * @throws EntityNotFoundException Entity not found
  */
 public function getHierarchy($id)
 {
     $location = $this->locationRepository->findOneBy(['id' => $id]);
     if (empty($location)) {
         throw new EntityNotFoundException();
     }
     $parents = $location->getAllParents();
     $hierarchy = array_merge($parents, [$location]);
     return $this->formatOutputLocationArray($hierarchy);
 }