mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
sf4 deprecated: migrate Doctrine ORM mapping to annotation
This commit is contained in:
parent
c69d6d6bb8
commit
6ccfa8a130
@ -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()
|
||||
{
|
||||
|
@ -20,30 +20,45 @@
|
||||
|
||||
namespace Chill\ActivityBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Chill\ActivityBundle\Entity\ActivityReasonCategory;
|
||||
|
||||
/**
|
||||
* ActivityReason
|
||||
* Class ActivityReason
|
||||
*
|
||||
* @package Chill\ActivityBundle\Entity
|
||||
* @ORM\Entity()
|
||||
* @ORM\Table(null)
|
||||
* @ORM\HasLifecycleCallbacks()
|
||||
*/
|
||||
class ActivityReason
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @ORM\Column(type="json_array")
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var ActivityReasonCategory
|
||||
* @ORM\ManyToOne(
|
||||
* targetEntity="Chill\ActivityBundle\Entity\ActivityReasonCategory",
|
||||
* inversedBy="reasons")
|
||||
*/
|
||||
private $category;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
private $active = true;
|
||||
|
||||
@ -62,7 +77,6 @@ class ActivityReason
|
||||
* Set name
|
||||
*
|
||||
* @param array $name
|
||||
*
|
||||
* @return ActivityReason
|
||||
*/
|
||||
public function setName($name)
|
||||
@ -100,7 +114,6 @@ class ActivityReason
|
||||
* category, the reason will become inactive
|
||||
*
|
||||
* @param ActivityReasonCategory $category
|
||||
*
|
||||
* @return ActivityReason
|
||||
*/
|
||||
public function setCategory(ActivityReasonCategory $category)
|
||||
@ -128,7 +141,6 @@ class ActivityReason
|
||||
* Set active
|
||||
*
|
||||
* @param boolean $active
|
||||
*
|
||||
* @return ActivityReason
|
||||
*/
|
||||
public function setActive($active)
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2015, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@ -20,36 +19,60 @@
|
||||
|
||||
namespace Chill\ActivityBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
/**
|
||||
* ActivityReasonCategory
|
||||
* Class ActivityReasonCategory
|
||||
*
|
||||
* @package Chill\ActivityBundle\Entity
|
||||
* @ORM\Entity()
|
||||
* @ORM\Table(null)
|
||||
* @ORM\HasLifecycleCallbacks()
|
||||
*/
|
||||
class ActivityReasonCategory
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @ORM\Column(type="json_array")
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
private $active = true;
|
||||
|
||||
/** @var ArrayCollection array of ActivityReason */
|
||||
/**
|
||||
* Array of ActivityReason
|
||||
* @var ArrayCollection
|
||||
* @ORM\OneToMany(
|
||||
* targetEntity="Chill\ActivityBundle\Entity\ActivityReason",
|
||||
* mappedBy="category")
|
||||
*/
|
||||
private $reasons;
|
||||
|
||||
/**
|
||||
* ActivityReasonCategory constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->reasons = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return 'ActivityReasonCategory('.$this->getName('x').')';
|
||||
@ -69,7 +92,6 @@ class ActivityReasonCategory
|
||||
* Set name
|
||||
*
|
||||
* @param array $name
|
||||
*
|
||||
* @return ActivityReasonCategory
|
||||
*/
|
||||
public function setName($name)
|
||||
|
@ -20,21 +20,37 @@
|
||||
|
||||
namespace Chill\ActivityBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* ActivityType
|
||||
* Class ActivityType
|
||||
*
|
||||
* @package Chill\ActivityBundle\Entity
|
||||
* @ORM\Entity()
|
||||
* @ORM\Table(null)
|
||||
* @ORM\HasLifecycleCallbacks()
|
||||
*/
|
||||
class ActivityType
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @ORM\Column(type="json_array")
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
private $active = true;
|
||||
|
||||
|
||||
@ -52,7 +68,6 @@ class ActivityType
|
||||
* Set name
|
||||
*
|
||||
* @param array $name
|
||||
*
|
||||
* @return ActivityType
|
||||
*/
|
||||
public function setName($name)
|
||||
@ -86,34 +101,31 @@ class ActivityType
|
||||
}
|
||||
|
||||
/**
|
||||
* get active
|
||||
*
|
||||
* Get active
|
||||
* return true if the type is active.
|
||||
*
|
||||
* @return boolean true if the type is active
|
||||
* @return boolean
|
||||
*/
|
||||
public function getActive() {
|
||||
return $this->active;
|
||||
}
|
||||
|
||||
/**
|
||||
* get active
|
||||
*
|
||||
* Is active
|
||||
* return true if the type is active
|
||||
*
|
||||
* @return boolean true if the type is active
|
||||
* @return boolean
|
||||
*/
|
||||
public function isActive() {
|
||||
return $this->getActive();
|
||||
}
|
||||
|
||||
/**
|
||||
* set active
|
||||
*
|
||||
* Set active
|
||||
* set to true if the type is active
|
||||
*
|
||||
* @param boolean $active
|
||||
* @return \Chill\ActivityBundle\Entity\ActivityType
|
||||
* @return ActivityType
|
||||
*/
|
||||
public function setActive($active) {
|
||||
$this->active = $active;
|
||||
|
@ -1,31 +0,0 @@
|
||||
Chill\ActivityBundle\Entity\Activity:
|
||||
type: entity
|
||||
table: null
|
||||
id:
|
||||
id:
|
||||
type: integer
|
||||
id: true
|
||||
generator:
|
||||
strategy: AUTO
|
||||
fields:
|
||||
date:
|
||||
type: datetime
|
||||
durationTime:
|
||||
type: time
|
||||
remark:
|
||||
type: text
|
||||
attendee:
|
||||
type: boolean
|
||||
manyToMany:
|
||||
reasons:
|
||||
targetEntity: Chill\ActivityBundle\Entity\ActivityReason
|
||||
manyToOne:
|
||||
user:
|
||||
targetEntity: Chill\MainBundle\Entity\User
|
||||
scope:
|
||||
targetEntity: Chill\MainBundle\Entity\Scope
|
||||
type:
|
||||
targetEntity: Chill\ActivityBundle\Entity\ActivityType
|
||||
person:
|
||||
targetEntity: Chill\PersonBundle\Entity\Person
|
||||
lifecycleCallbacks: { }
|
@ -1,18 +0,0 @@
|
||||
Chill\ActivityBundle\Entity\ActivityReason:
|
||||
type: entity
|
||||
table: null
|
||||
id:
|
||||
id:
|
||||
type: integer
|
||||
id: true
|
||||
generator:
|
||||
strategy: AUTO
|
||||
fields:
|
||||
name:
|
||||
type: json_array
|
||||
active:
|
||||
type: boolean
|
||||
manyToOne:
|
||||
category:
|
||||
targetEntity: Chill\ActivityBundle\Entity\ActivityReasonCategory
|
||||
lifecycleCallbacks: { }
|
@ -1,19 +0,0 @@
|
||||
Chill\ActivityBundle\Entity\ActivityReasonCategory:
|
||||
type: entity
|
||||
table: null
|
||||
id:
|
||||
id:
|
||||
type: integer
|
||||
id: true
|
||||
generator:
|
||||
strategy: AUTO
|
||||
fields:
|
||||
name:
|
||||
type: json_array
|
||||
active:
|
||||
type: boolean
|
||||
oneToMany:
|
||||
reasons:
|
||||
targetEntity: Chill\ActivityBundle\Entity\ActivityReason
|
||||
mappedBy: category
|
||||
lifecycleCallbacks: { }
|
@ -1,16 +0,0 @@
|
||||
Chill\ActivityBundle\Entity\ActivityType:
|
||||
type: entity
|
||||
table: null
|
||||
id:
|
||||
id:
|
||||
type: integer
|
||||
id: true
|
||||
generator:
|
||||
strategy: AUTO
|
||||
fields:
|
||||
name:
|
||||
type: json_array
|
||||
active:
|
||||
type: boolean
|
||||
default: true
|
||||
lifecycleCallbacks: { }
|
Loading…
x
Reference in New Issue
Block a user