/**
  * {@inheritdoc}
  */
 public function jsonSerialize()
 {
     $parent = $this->organization->getParent();
     $daughters = $this->repository->getDaughters($this->organization);
     $daughtersNames = array_map(function (Organization $daughter) {
         return $daughter->getName();
     }, $daughters);
     return ['parent' => is_null($parent) ? null : $parent->getName(), 'daughters' => $daughtersNames];
 }
 /**
  * Get all relationships for organization
  *
  * @param $id
  *
  * @return JsonResponse|Response
  */
 public function relationships($id)
 {
     $organization = $this->organizationRepository->find($id);
     if (is_null($organization)) {
         return new Response(null, Response::HTTP_NOT_FOUND);
     }
     return new JsonResponse(new RelationshipDataTransferObject($organization, $this->organizationRepository));
 }
Example #3
0
 /**
  * @param Organization $organization
  */
 public function delete(Organization $organization)
 {
     $this->repository->remove($organization);
 }