POST, PUT, PATCH working for thirdparty and added to swagger. Assert for 'centers'(temporarily) removed from thirdparty entity

This commit is contained in:
Julie Lenaerts 2021-09-29 11:41:08 +02:00
parent 644d0420ce
commit fc1dd499c4
3 changed files with 25 additions and 24 deletions

View File

@ -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,

View File

@ -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;
}

View File

@ -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: