sf4 deprecated: migrate Doctrine ORM mapping to annotation

This commit is contained in:
2020-07-24 20:20:07 +02:00
parent c69d6d6bb8
commit 6ccfa8a130
8 changed files with 101 additions and 123 deletions

View File

@@ -20,82 +20,105 @@
namespace Chill\ActivityBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Chill\MainBundle\Entity\Scope;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Entity\Center;
use Chill\ActivityBundle\Entity\ActivityReason;
use Chill\ActivityBundle\Entity\ActivityType;
use Chill\PersonBundle\Entity\Person;
use Chill\MainBundle\Entity\HasCenterInterface;
use Chill\MainBundle\Entity\HasScopeInterface;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
use Chill\MainBundle\Validator\Constraints\Entity\UserCircleConsistency;
/**
* Activity
* @UserCircleConsistency(
* "CHILL_ACTIVITY_SEE_DETAILS",
* getUserFunction="getUser",
* path="scope"
* )
* Class Activity
*
* @package Chill\ActivityBundle\Entity
* @ORM\Entity()
* @ORM\Table(null)
* @ORM\HasLifecycleCallbacks()
* @UserCircleConsistency(
* "CHILL_ACTIVITY_SEE_DETAILS",
* getUserFunction="getUser",
* path="scope")
*/
class Activity implements HasCenterInterface, HasScopeInterface
{
/**
* @var integer
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var User
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
*/
private $user;
/**
* @var \DateTime
* @ORM\Column(type="datetime")
*/
private $date;
/**
* @var \DateTime
* @ORM\Column(type="time")
*/
private $durationTime;
/**
* @var string
* @ORM\Column(type="text")
*/
private $remark;
/**
* @var boolean
* @ORM\Column(type="boolean")
*/
private $attendee;
/**
* @var \Doctrine\Common\Collections\Collection
* @var ActivityReason
* @ORM\ManyToMany(targetEntity="Chill\ActivityBundle\Entity\ActivityReason")
*/
private $reasons;
/**
* @var ActivityType
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType")
*/
private $type;
/**
* @var Scope
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope")
*/
private $scope;
/**
* @var Person
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person")
*/
private $person;
/**
* Activity constructor.
*/
public function __construct()
{
$this->reasons = new ArrayCollection();
}
/**
* Get id
*
@@ -110,7 +133,6 @@ class Activity implements HasCenterInterface, HasScopeInterface
* Set user
*
* @param User $user
*
* @return Activity
*/
public function setUser(User $user)
@@ -134,7 +156,6 @@ class Activity implements HasCenterInterface, HasScopeInterface
* Set date
*
* @param \DateTime $date
*
* @return Activity
*/
public function setDate($date)
@@ -158,7 +179,6 @@ class Activity implements HasCenterInterface, HasScopeInterface
* Set durationTime
*
* @param \DateTime $durationTime
*
* @return Activity
*/
public function setDurationTime($durationTime)
@@ -182,7 +202,6 @@ class Activity implements HasCenterInterface, HasScopeInterface
* Set remark
*
* @param string $remark
*
* @return Activity
*/
public function setRemark($remark)
@@ -206,7 +225,6 @@ class Activity implements HasCenterInterface, HasScopeInterface
* Set attendee
*
* @param boolean $attendee
*
* @return Activity
*/
public function setAttendee($attendee)
@@ -230,7 +248,6 @@ class Activity implements HasCenterInterface, HasScopeInterface
* Add a reason
*
* @param ActivityReason $reason
*
* @return Activity
*/
public function addReason(ActivityReason $reason)
@@ -240,6 +257,9 @@ class Activity implements HasCenterInterface, HasScopeInterface
return $this;
}
/**
* @param ActivityReason $reason
*/
public function removeReason(ActivityReason $reason)
{
$this->reasons->removeElement($reason);
@@ -248,7 +268,7 @@ class Activity implements HasCenterInterface, HasScopeInterface
/**
* Get reasons
*
* @return \Doctrine\Common\Collections\Collection
* @return Collection
*/
public function getReasons()
{
@@ -259,7 +279,6 @@ class Activity implements HasCenterInterface, HasScopeInterface
* Set type
*
* @param ActivityType $type
*
* @return Activity
*/
public function setType(ActivityType $type)
@@ -283,7 +302,6 @@ class Activity implements HasCenterInterface, HasScopeInterface
* Set scope
*
* @param Scope $scope
*
* @return Activity
*/
public function setScope(Scope $scope)
@@ -307,7 +325,6 @@ class Activity implements HasCenterInterface, HasScopeInterface
* Set person
*
* @param Person $person
*
* @return Activity
*/
public function setPerson(Person $person)
@@ -329,10 +346,9 @@ class Activity implements HasCenterInterface, HasScopeInterface
/**
* get the center
*
* center is extracted from person
*
* @return \Chill\MainBundle\Entity\Center
* @return Center
*/
public function getCenter()
{