From fc1dd499c48b3acc160f292e3b756ad4f6601c11 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 29 Sep 2021 11:41:08 +0200 Subject: [PATCH] POST, PUT, PATCH working for thirdparty and added to swagger. Assert for 'centers'(temporarily) removed from thirdparty entity --- .../ChillThirdPartyExtension.php | 16 ------------ .../Entity/ThirdParty.php | 7 +++-- .../chill.api.specs.yaml | 26 ++++++++++++++++--- 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/Bundle/ChillThirdPartyBundle/DependencyInjection/ChillThirdPartyExtension.php b/src/Bundle/ChillThirdPartyBundle/DependencyInjection/ChillThirdPartyExtension.php index 2fd0f723d..5ebac821b 100644 --- a/src/Bundle/ChillThirdPartyBundle/DependencyInjection/ChillThirdPartyExtension.php +++ b/src/Bundle/ChillThirdPartyBundle/DependencyInjection/ChillThirdPartyExtension.php @@ -62,22 +62,6 @@ class ChillThirdPartyExtension extends Extension implements PrependExtensionInte //'base_role' => \Chill\ThirdPartyBundle\Security\Authorization\ThirdPartyVoter::SHOW, //'controller' => \Chill\ThirdPartyBundle\Controller\ThirdPartyApiController::class, 'actions' => [ - '_index' => [ - 'methods' => [ - Request::METHOD_GET => true, - Request::METHOD_HEAD => true, - Request::METHOD_POST => true, - Request::METHOD_PATCH => true, - Request::METHOD_PUT => true - ], - 'roles' => [ - Request::METHOD_GET => \Chill\ThirdPartyBundle\Security\Voter\ThirdPartyVoter::SHOW, - Request::METHOD_HEAD => \Chill\ThirdPartyBundle\Security\Voter\ThirdPartyVoter::SHOW, - Request::METHOD_POST => \Chill\ThirdPartyBundle\Security\Voter\ThirdPartyVoter::CREATE, - Request::METHOD_PUT => \Chill\ThirdPartyBundle\Security\Voter\ThirdPartyVoter::CREATE, - Request::METHOD_PATCH => \Chill\ThirdPartyBundle\Security\Voter\ThirdPartyVoter::CREATE - ], - ], '_entity' => [ 'methods' => [ Request::METHOD_GET => true, diff --git a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php index 842e57b8b..30f28791b 100644 --- a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php +++ b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php @@ -96,7 +96,7 @@ class ThirdParty * @ORM\Column(name="types", type="json", nullable=true) * @Assert\Count(min=1) */ - private $type; + private $types; /** * Contact Persons: One Institutional ThirdParty has Many Contact Persons @@ -170,7 +170,6 @@ class ThirdParty * @var Collection * @ORM\ManyToMany(targetEntity="\Chill\MainBundle\Entity\Center") * @ORM\JoinTable(name="chill_3party.party_center") - * @Assert\Count(min=1) */ private $centers; @@ -327,7 +326,7 @@ class ThirdParty * @param array|null $type * @return ThirdParty */ - public function setType(array $type = null) + public function setTypes(array $type = null) { // remove all keys from the input data $this->type = \array_values($type); @@ -340,7 +339,7 @@ class ThirdParty * * @return array|null */ - public function getType() + public function getTypes() { return $this->type; } diff --git a/src/Bundle/ChillThirdPartyBundle/chill.api.specs.yaml b/src/Bundle/ChillThirdPartyBundle/chill.api.specs.yaml index c5d9346ba..50f0af70f 100644 --- a/src/Bundle/ChillThirdPartyBundle/chill.api.specs.yaml +++ b/src/Bundle/ChillThirdPartyBundle/chill.api.specs.yaml @@ -16,14 +16,32 @@ components: id: type: integer readOnly: true + type: + type: string + enum: + - "thirdparty" name: type: string - nameCompany: - type: string - acronym: - type: string email: type: string + telephone: + type: string + comment: + type: string + # centers: + # type: array + # items: + # type: object + # $ref: "#/components/schemas/CenterById" + # CenterById: + # type: object + # properties: + # type: + # type: string + # enum: + # - "Center" + # id: + # type: integer paths: /1.0/thirdparty/thirdparty.json: