activity: avoid adding persons|Users|Thirdparty if not allowed

This commit is contained in:
nobohan
2021-11-19 11:45:23 +01:00
parent f5a6314ca2
commit aa53df8bb0
5 changed files with 332 additions and 227 deletions

View File

@@ -22,6 +22,7 @@ use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
use Symfony\Component\Serializer\Annotation\SerializedName;
/**
* Class Activity
@@ -30,7 +31,7 @@ use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
* @ORM\Entity(repositoryClass="Chill\ActivityBundle\Repository\ActivityRepository")
* @ORM\Table(name="activity")
* @ORM\HasLifecycleCallbacks()
* @DiscriminatorMap(typeProperty="type", mapping={
* @DiscriminatorMap(typeProperty="_type", mapping={
* "activity"=Activity::class
* })
*/
@@ -102,6 +103,8 @@ class Activity implements HasCenterInterface, HasScopeInterface, AccompanyingPer
/**
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType")
* @Groups({"read"})
* @SerializedName("activityType")
*/
private ActivityType $type;

View File

@@ -21,6 +21,7 @@
namespace Chill\ActivityBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* Class ActivityType
@@ -45,11 +46,13 @@ class ActivityType
/**
* @ORM\Column(type="json")
* @Groups({"read"})
*/
private array $name = [];
/**
* @ORM\Column(type="boolean")
* @Groups({"read"})
*/
private bool $active = true;
@@ -100,6 +103,7 @@ class ActivityType
/**
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
* @Groups({"read"})
*/
private int $personsVisible = self::FIELD_OPTIONAL;
@@ -110,6 +114,7 @@ class ActivityType
/**
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
* @Groups({"read"})
*/
private int $thirdPartiesVisible = self::FIELD_INVISIBLE;
@@ -190,6 +195,7 @@ class ActivityType
/**
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
* @Groups({"read"})
*/
private int $usersVisible = self::FIELD_OPTIONAL;