sf4 deprecated: migrate Doctrine ORM mapping to annotation

This commit is contained in:
Tchama 2020-07-24 14:51:34 +02:00
parent 3033be78d2
commit 2746d3e003
20 changed files with 434 additions and 410 deletions

View File

@ -2,30 +2,45 @@
namespace Chill\MainBundle\Entity; namespace Chill\MainBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface;
/** /**
* Address * Address
*
* @ORM\Entity()
* @ORM\Table(name="chill_main_address")
* @ORM\HasLifecycleCallbacks()
*/ */
class Address class Address
{ {
/** /**
* @var integer * @var integer
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/ */
private $id; private $id;
/** /**
* @var string * @var string
*
* @ORM\Column(type="string", length=255)
*/ */
private $streetAddress1 = ''; private $streetAddress1 = '';
/** /**
* @var string * @var string
*
* @ORM\Column(type="string", length=255)
*/ */
private $streetAddress2 = ''; private $streetAddress2 = '';
/** /**
* @var \Chill\MainBundle\Entity\PostalCode * @var PostalCode
*
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\PostalCode")
*/ */
private $postcode; private $postcode;
@ -34,6 +49,8 @@ class Address
* of address. By default, the current date. * of address. By default, the current date.
* *
* @var \DateTime * @var \DateTime
*
* @ORM\Column(type="date")
*/ */
private $validFrom; private $validFrom;
@ -41,15 +58,19 @@ class Address
* True if the address is a "no address", aka homeless person, ... * True if the address is a "no address", aka homeless person, ...
* *
* @var bool * @var bool
* @ORM\Column(type="boolean")
*/ */
private $isNoAddress = false; private $isNoAddress = false;
/**
* Address constructor.
*/
public function __construct() public function __construct()
{ {
$this->validFrom = new \DateTime(); $this->validFrom = new \DateTime();
} }
/** /**
* Get id * Get id
* *
@ -111,11 +132,11 @@ class Address
/** /**
* Set postcode * Set postcode
* *
* @param \Chill\MainBundle\Entity\PostalCode $postcode * @param PostalCode $postcode
* *
* @return Address * @return Address
*/ */
public function setPostcode(\Chill\MainBundle\Entity\PostalCode $postcode = null) public function setPostcode(PostalCode $postcode = null)
{ {
$this->postcode = $postcode; $this->postcode = $postcode;
@ -125,7 +146,7 @@ class Address
/** /**
* Get postcode * Get postcode
* *
* @return \Chill\MainBundle\Entity\PostalCode * @return PostalCode
*/ */
public function getPostcode() public function getPostcode()
{ {
@ -133,7 +154,6 @@ class Address
} }
/** /**
*
* @return \DateTime * @return \DateTime
*/ */
public function getValidFrom() public function getValidFrom()
@ -142,9 +162,8 @@ class Address
} }
/** /**
*
* @param \DateTime $validFrom * @param \DateTime $validFrom
* @return \Chill\MainBundle\Entity\Address * @return Address
*/ */
public function setValidFrom(\DateTime $validFrom) public function setValidFrom(\DateTime $validFrom)
{ {
@ -153,7 +172,7 @@ class Address
} }
/** /**
* get "isNoAddress" * Get IsNoAddress
* *
* Indicate true if the address is a fake address (homeless, ...) * Indicate true if the address is a fake address (homeless, ...)
* *
@ -164,13 +183,16 @@ class Address
return $this->isNoAddress; return $this->isNoAddress;
} }
/**
* @return bool
*/
public function isNoAddress(): bool public function isNoAddress(): bool
{ {
return $this->getIsNoAddress(); return $this->getIsNoAddress();
} }
/** /**
* set Is No Address * Set IsNoAddress
* *
* Indicate true if the address is a fake address (homeless, ...) * Indicate true if the address is a fake address (homeless, ...)
* *
@ -223,8 +245,11 @@ class Address
->addViolation(); ->addViolation();
} }
} }
/**
* @param Address $original
* @return Address
*/
public static function createFromAddress(Address $original) : Address public static function createFromAddress(Address $original) : Address
{ {
return (new Address()) return (new Address())

View File

@ -20,68 +20,109 @@
namespace Chill\MainBundle\Entity; namespace Chill\MainBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
/** /**
* * @ORM\Entity(repositoryClass="Chill\MainBundle\Repository\CenterRepository")
* @ORM\Table(name="centers")
* *
* @author Julien Fastré <julien.fastre@champs-libres.coop> * @author Julien Fastré <julien.fastre@champs-libres.coop>
*/ */
class Center implements HasCenterInterface class Center implements HasCenterInterface
{ {
/** /**
* @var integer
* *
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string * @var string
*
* @ORM\Column(type="string", length=255)
*/ */
private $name; private $name;
/** /**
* @var Collection
* *
* @var int * @ORM\OneToMany(
*/ * targetEntity="Chill\MainBundle\Entity\GroupCenter",
private $id; * mappedBy="center"
* )
/**
*
* @var \Doctrine\Common\Collections\Collection
*/ */
private $groupCenters; private $groupCenters;
/**
* Center constructor.
*/
public function __construct() public function __construct()
{ {
$this->groupCenters = new \Doctrine\Common\Collections\ArrayCollection(); $this->groupCenters = new \Doctrine\Common\Collections\ArrayCollection();
} }
/**
* @return string
*/
public function getName() public function getName()
{ {
return $this->name; return $this->name;
} }
/**
* @param $name
* @return $this
*/
public function setName($name) public function setName($name)
{ {
$this->name = $name; $this->name = $name;
return $this; return $this;
} }
/**
* @return int
*/
public function getId() public function getId()
{ {
return $this->id; return $this->id;
} }
/**
* @return ArrayCollection|Collection
*/
public function getGroupCenters() public function getGroupCenters()
{ {
return $this->groupCenters; return $this->groupCenters;
} }
/**
* @param GroupCenter $groupCenter
* @return $this
*/
public function addGroupCenter(GroupCenter $groupCenter) public function addGroupCenter(GroupCenter $groupCenter)
{ {
$this->groupCenters->add($groupCenter); $this->groupCenters->add($groupCenter);
return $this; return $this;
} }
/**
* @return string
*/
public function __toString() public function __toString()
{ {
return $this->getName(); return $this->getName();
} }
/**
* @return $this|Center
*/
public function getCenter() public function getCenter()
{ {
return $this; return $this;

View File

@ -2,24 +2,39 @@
namespace Chill\MainBundle\Entity; namespace Chill\MainBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/** /**
* Country * Country
*
* @ORM\Entity()
* @ORM\Table(name="country")
* sf4 check, in yml table was set to null !?
* @ORM\Cache(usage="READ_ONLY", region="country_cache_region")
* @ORM\HasLifecycleCallbacks()
*/ */
class Country class Country
{ {
/** /**
* @var integer * @var integer
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/ */
private $id; private $id;
/** /**
* @var string * @var string
*
* @ORM\Column(type="json_array")
*/ */
private $name; private $name;
/** /**
*
* @var string * @var string
*
* @ORM\Column(type="string", length=3)
*/ */
private $countryCode; private $countryCode;
@ -57,9 +72,11 @@ class Country
return $this->name; return $this->name;
} }
/**
* @return string
public function __toString() { */
public function __toString()
{
return $this->getName(); return $this->getName();
} }

View File

@ -20,55 +20,80 @@
namespace Chill\MainBundle\Entity; namespace Chill\MainBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Chill\MainBundle\Entity\Center; use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\PermissionsGroup; use Chill\MainBundle\Entity\PermissionsGroup;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
/** /**
* * @ORM\Entity()
* @ORM\Table(name="group_centers")
* @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="acl_cache_region")
* *
* @author Julien Fastré <julien.fastre@champs-libres.coop> * @author Julien Fastré <julien.fastre@champs-libres.coop>
*/ */
class GroupCenter class GroupCenter
{ {
/** /**
*
* @var int * @var int
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/ */
private $id; private $id;
/** /**
*
* @var Center * @var Center
*
* @ORM\ManyToOne(
* targetEntity="Chill\MainBundle\Entity\Center",
* inversedBy="groupCenters"
* )
* @ORM\Cache(usage="NONSTRICT_READ_WRITE")
*/ */
private $center; private $center;
/** /**
* @var Collection
* *
* @var Collection * @ORM\ManyToMany(
* targetEntity="Chill\MainBundle\Entity\User",
* mappedBy="groupCenters"
* )
*/ */
private $users; private $users;
/** /**
*
* @var PermissionsGroup * @var PermissionsGroup
*
* @ORM\ManyToOne(
* targetEntity="Chill\MainBundle\Entity\PermissionsGroup",
* inversedBy="groupCenters")
* @ORM\Cache(usage="NONSTRICT_READ_WRITE")
*/ */
private $permissionsGroup; private $permissionsGroup;
/**
* GroupCenter constructor.
*/
public function __construct() public function __construct()
{ {
$this->permissionsGroup = new ArrayCollection(); $this->permissionsGroup = new ArrayCollection();
$this->users = new ArrayCollection(); $this->users = new ArrayCollection();
} }
/**
* @return int
*/
public function getId() public function getId()
{ {
return $this->id; return $this->id;
} }
/** /**
*
* @return Center * @return Center
*/ */
public function getCenter() public function getCenter()
@ -77,7 +102,6 @@ class GroupCenter
} }
/** /**
*
* @param Center $center * @param Center $center
* @return \Chill\MainBundle\Entity\GroupCenter * @return \Chill\MainBundle\Entity\GroupCenter
*/ */
@ -87,13 +111,15 @@ class GroupCenter
return $this; return $this;
} }
/**
* @return ArrayCollection|Collection
*/
public function getUsers() public function getUsers()
{ {
return $this->users; return $this->users;
} }
/** /**
*
* @return PermissionGroup * @return PermissionGroup
*/ */
public function getPermissionsGroup() public function getPermissionsGroup()
@ -102,7 +128,6 @@ class GroupCenter
} }
/** /**
*
* @param \Chill\MainBundle\Entity\PermissionsGroup $permissionGroup * @param \Chill\MainBundle\Entity\PermissionsGroup $permissionGroup
* @return \Chill\MainBundle\Entity\GroupCenter * @return \Chill\MainBundle\Entity\GroupCenter
*/ */

View File

@ -20,18 +20,31 @@
namespace Chill\MainBundle\Entity; namespace Chill\MainBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/** /**
* Language * Language
*
* @ORM\Entity()
* @ORM\Table(name="language")
* sf4 check, in yml table was set to null !?
* @ORM\Cache(usage="READ_ONLY", region="language_cache_region")
* @ORM\HasLifecycleCallbacks()
*/ */
class Language class Language
{ {
/** /**
* @var string * @var string
*
* @ORM\Id()
* @ORM\Column(type="string")
*/ */
private $id; private $id;
/** /**
* @var string array * @var string array
*
* @ORM\Column(type="json_array")
*/ */
private $name; private $name;

View File

@ -20,72 +20,103 @@
namespace Chill\MainBundle\Entity; namespace Chill\MainBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
use Chill\MainBundle\Entity\RoleScope; use Chill\MainBundle\Entity\RoleScope;
use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface;
/** /**
* * @ORM\Entity()
* @ORM\Table(name="permission_groups")
* @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="acl_cache_region")
* *
* @author Julien Fastré <julien.fastre@champs-libres.coop> * @author Julien Fastré <julien.fastre@champs-libres.coop>
*/ */
class PermissionsGroup class PermissionsGroup
{ {
/** /**
* @var integer
* *
* @var int * @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/ */
private $id; private $id;
/** /**
*
* @var string * @var string
*
* @ORM\Column(type="string", length=255)
*/ */
private $name; private $name;
/** /**
*
* @var string[] * @var string[]
*
* @ORM\Column(type="json")
*/ */
private $flags = []; private $flags = [];
/** /**
* @var Collection
* *
* @var \Doctrine\Common\Collections\Collection * @ORM\ManyToMany(
* targetEntity="Chill\MainBundle\Entity\RoleScope",
* inversedBy="permissionsGroups",
* cascade={ "persist" })
* @ORM\Cache(usage="NONSTRICT_READ_WRITE")
*/ */
private $roleScopes; private $roleScopes;
/** /**
* @var Collection
* *
* @var \Doctrine\Common\Collections\Collection * @ORM\OneToMany(
* targetEntity="Chill\MainBundle\Entity\GroupCenter",
* mappedBy="permissionsGroup"
* )
*/ */
private $groupCenters; private $groupCenters;
/**
* PermissionsGroup constructor.
*/
public function __construct() public function __construct()
{ {
$this->roleScopes = new \Doctrine\Common\Collections\ArrayCollection(); $this->roleScopes = new \Doctrine\Common\Collections\ArrayCollection();
$this->groupCenters = new \Doctrine\Common\Collections\ArrayCollection(); $this->groupCenters = new \Doctrine\Common\Collections\ArrayCollection();
} }
/**
* @return int
*/
public function getId() public function getId()
{ {
return $this->id; return $this->id;
} }
/** /**
*
* @return string * @return string
*/ */
public function getName() public function getName()
{ {
return $this->name; return $this->name;
} }
/**
* @return ArrayCollection|Collection
*/
public function getRoleScopes() public function getRoleScopes()
{ {
return $this->roleScopes; return $this->roleScopes;
} }
/**
* @param $name
* @return $this
*/
public function setName($name) public function setName($name)
{ {
$this->name = $name; $this->name = $name;
@ -93,7 +124,6 @@ class PermissionsGroup
} }
/** /**
*
* @param RoleScope $roleScope * @param RoleScope $roleScope
*/ */
public function addRoleScope(RoleScope $roleScope) public function addRoleScope(RoleScope $roleScope)
@ -102,7 +132,6 @@ class PermissionsGroup
} }
/** /**
*
* @param RoleScope $roleScope * @param RoleScope $roleScope
* @throws \RuntimeException if the roleScope could not be removed. * @throws \RuntimeException if the roleScope could not be removed.
*/ */
@ -115,21 +144,28 @@ class PermissionsGroup
} }
} }
/**
* @return string[]
*/
public function getFlags() public function getFlags()
{ {
return $this->flags; return $this->flags;
} }
/**
* @param array $flags
* @return $this
*/
public function setFlags(array $flags) public function setFlags(array $flags)
{ {
$this->flags = $flags; $this->flags = $flags;
return $this; return $this;
} }
/** /**
* Test that a role scope is associated only once with the permission group * Test that a role scope is associated only once
* with the permission group
* *
* @param ExecutionContextInterface $context * @param ExecutionContextInterface $context
*/ */
@ -150,5 +186,4 @@ class PermissionsGroup
} }
} }
} }

View File

@ -2,28 +2,50 @@
namespace Chill\MainBundle\Entity; namespace Chill\MainBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/** /**
* PostalCode * PostalCode
*
* @ORM\Entity(repositoryClass="Chill\MainBundle\Repository\PostalCodeRepository")
* @ORM\Table(
* name="chill_main_postal_code",
* indexes={@ORM\Index(
* name="search_name_code",
* columns={"code", "label"}
* )})
* @ORM\HasLifecycleCallbacks()
*
*/ */
class PostalCode class PostalCode
{ {
/** /**
* @var integer * @var integer
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/ */
private $id; private $id;
/** /**
* @var string * @var string
*
* @ORM\Column(type="string", length=255, name="label")
*/ */
private $name; private $name;
/** /**
* @var string * @var string
*
* @ORM\Column(type="string", length=100)
*/ */
private $code; private $code;
/** /**
* @var \Chill\MainBundle\Entity\Country * @var Country
*
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Country")
*/ */
private $country; private $country;
@ -89,11 +111,11 @@ class PostalCode
/** /**
* Set country * Set country
* *
* @param \Chill\MainBundle\Entity\Country $country * @param Country $country
* *
* @return PostalCode * @return PostalCode
*/ */
public function setCountry(\Chill\MainBundle\Entity\Country $country = null) public function setCountry(Country $country = null)
{ {
$this->country = $country; $this->country = $country;
@ -103,7 +125,7 @@ class PostalCode
/** /**
* Get country * Get country
* *
* @return \Chill\MainBundle\Entity\Country * @return Country
*/ */
public function getCountry() public function getCountry()
{ {

View File

@ -20,49 +20,73 @@
namespace Chill\MainBundle\Entity; namespace Chill\MainBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
/** /**
* * @ORM\Entity()
* @ORM\Table(name="role_scopes")
* @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="acl_cache_region")
* *
* @author Julien Fastré <julien.fastre@champs-libres.coop> * @author Julien Fastré <julien.fastre@champs-libres.coop>
*/ */
class RoleScope class RoleScope
{ {
/** /**
* @var integer
* *
* @var int * @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/ */
private $id; private $id;
/** /**
*
* @var string * @var string
*
* @ORM\Column(type="string", length=255)
*/ */
private $role; private $role;
/** /**
* @var Scope
* *
* @var Scope * @ORM\ManyToOne(
* targetEntity="Chill\MainBundle\Entity\Scope",
* inversedBy="roleScopes")
* @ORM\JoinColumn(nullable=true, name="scope_id")
* @ORM\Cache(usage="NONSTRICT_READ_WRITE")
*/ */
private $scope; private $scope;
/** /**
* @var Collection
* *
* @var \Doctrine\Common\Collections\Collection * @ORM\ManyToMany(
* targetEntity="Chill\MainBundle\Entity\PermissionsGroup",
* mappedBy="roleScopes")
*/ */
private $permissionsGroups; private $permissionsGroups;
/**
* RoleScope constructor.
*/
public function __construct() { public function __construct() {
$this->new = true; $this->new = true;
$this->permissionsGroups = new \Doctrine\Common\Collections\ArrayCollection(); $this->permissionsGroups = new ArrayCollection();
} }
/**
* @return int
*/
public function getId() public function getId()
{ {
return $this->id; return $this->id;
} }
/** /**
*
* @return string * @return string
*/ */
public function getRole() public function getRole()
@ -71,7 +95,6 @@ class RoleScope
} }
/** /**
*
* @return Scope * @return Scope
*/ */
public function getScope() public function getScope()
@ -80,9 +103,8 @@ class RoleScope
} }
/** /**
*
* @param type $role * @param type $role
* @return \Chill\MainBundle\Entity\RoleScope * @return RoleScope
*/ */
public function setRole($role) public function setRole($role)
{ {
@ -92,9 +114,8 @@ class RoleScope
} }
/** /**
* * @param Scope $scope
* @param \Chill\MainBundle\Entity\Scope $scope * @return RoleScope
* @return \Chill\MainBundle\Entity\RoleScope
*/ */
public function setScope(Scope $scope = null) public function setScope(Scope $scope = null)
{ {

View File

@ -20,18 +20,26 @@
namespace Chill\MainBundle\Entity; namespace Chill\MainBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
use Chill\MainBundle\Entity\RoleScope; use Chill\MainBundle\Entity\RoleScope;
/** /**
* * @ORM\Entity()
* @ORM\Table(name="scopes")
* @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="acl_cache_region")
* *
* @author Julien Fastré <julien.fastre@champs-libres.coop> * @author Julien Fastré <julien.fastre@champs-libres.coop>
*/ */
class Scope class Scope
{ {
/** /**
* @var integer
* *
* @var int * @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/ */
private $id; private $id;
@ -39,22 +47,31 @@ class Scope
* translatable names * translatable names
* *
* @var array * @var array
*
* @ORM\Column(type="json_array")
*/ */
private $name = array(); private $name = [];
/** /**
* @var Collection
* *
* @var \Doctrine\Common\Collections\Collection * @ORM\OneToMany(
* targetEntity="Chill\MainBundle\Entity\RoleScope",
* mappedBy="scope")
* @ORM\Cache(usage="NONSTRICT_READ_WRITE")
*/ */
private $roleScopes; private $roleScopes;
/**
* Scope constructor.
*/
public function __construct() public function __construct()
{ {
$this->roleScopes = new \Doctrine\Common\Collections\ArrayCollection(); $this->roleScopes = new ArrayCollection();
} }
/** /**
*
* @return int * @return int
*/ */
public function getId() public function getId()
@ -63,14 +80,17 @@ class Scope
} }
/** /**
*
* @return array * @return array
*/ */
public function getName() public function getName()
{ {
return $this->name; return $this->name;
} }
/**
* @param $name
* @return $this
*/
public function setName($name) public function setName($name)
{ {
$this->name = $name; $this->name = $name;
@ -78,14 +98,16 @@ class Scope
} }
/** /**
* * @return Collection
* @return \Doctrine\Common\Collections\Collection
*/ */
public function getRoleScopes() public function getRoleScopes()
{ {
return $this->roleScopes; return $this->roleScopes;
} }
/**
* @param RoleScope $roleScope
*/
public function addRoleScope(RoleScope $roleScope) public function addRoleScope(RoleScope $roleScope)
{ {
$this->roleScopes->add($roleScope); $this->roleScopes->add($roleScope);

View File

@ -2,85 +2,126 @@
namespace Chill\MainBundle\Entity; namespace Chill\MainBundle\Entity;
use Symfony\Component\Security\Core\User\AdvancedUserInterface; use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Security\Core\User\AdvancedUserInterface;
use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface;
/** /**
* User * User
*
* @ORM\Entity(repositoryClass="Chill\MainBundle\Repository\UserRepository")
* @ORM\Table(name="users")
* @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="acl_cache_region")
*/ */
class User implements AdvancedUserInterface { class User implements AdvancedUserInterface {
/** /**
* @var integer * @var integer
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/ */
protected $id; protected $id;
/** /**
* @var string * @var string
*
* @ORM\Column(type="string", length=80)
*/ */
private $username; private $username;
/** /**
*
* @var string * @var string
*
* @ORM\Column(
* type="string",
* length=80,
* unique=true)
*/ */
private $usernameCanonical; private $usernameCanonical;
/** /**
*
* @var string * @var string
*
* @ORM\Column(type="string", length=150, nullable=true)
*/ */
private $email; private $email;
/** /**
*
* @var string * @var string
*
* @ORM\Column(
* type="string",
* length=150,
* nullable=true,
* unique=true)
*/ */
private $emailCanonical; private $emailCanonical;
/** /**
* @var string
* *
* @var string * @ORM\Column(type="string", length=255)
*/ */
private $password; private $password;
/** /**
*
* @var string * @var string
* @internal must be set to null if we use bcrypt * @internal must be set to null if we use bcrypt
*
* @ORM\Column(type="string", length=255, nullable=true)
*/ */
private $salt = null; private $salt = null;
/** /**
*
* @var boolean * @var boolean
*
* @ORM\Column(type="boolean")
* sf4 check: in yml was false by default !?
*/ */
private $locked = true; private $locked = true;
/** /**
*
* @var boolean * @var boolean
*
* @ORM\Column(type="boolean")
*/ */
private $enabled = true; private $enabled = true;
/** /**
* @var Collection
* *
* @var Collection * @ORM\ManyToMany(
* targetEntity="Chill\MainBundle\Entity\GroupCenter",
* inversedBy="users")
* @ORM\Cache(usage="NONSTRICT_READ_WRITE")
*/ */
private $groupCenters; private $groupCenters;
/**
* User constructor.
*/
public function __construct() public function __construct()
{ {
$this->groupCenters = new ArrayCollection(); $this->groupCenters = new ArrayCollection();
} }
/**
* @return string
*/
public function __toString()
{
return $this->getUsername();
}
/** /**
* Get id * Get id
* *
* @return integer * @return integer
*/ */
public function getId() public function getId()
{ {
@ -100,76 +141,95 @@ class User implements AdvancedUserInterface {
return $this; return $this;
} }
public function __toString() {
return $this->getUsername();
}
public function eraseCredentials()
{
}
/** /**
*
* @return string * @return string
*/ */
public function getPassword()
{
return $this->password;
}
public function getRoles()
{
return array('ROLE_USER');
}
public function getSalt()
{
return $this->salt;
}
public function getUsername() public function getUsername()
{ {
return $this->username; return $this->username;
} }
public function getUsernameCanonical() /**
*/
public function eraseCredentials() {}
/**
* @return array
*/
public function getRoles()
{ {
return $this->usernameCanonical; return array('ROLE_USER');
} }
public function getEmail() /**
* @return null|string
*/
public function getSalt()
{ {
return $this->email; return $this->salt;
} }
public function getEmailCanonical() /**
{ * @param $usernameCanonical
return $this->emailCanonical; * @return $this
} */
public function setUsernameCanonical($usernameCanonical) public function setUsernameCanonical($usernameCanonical)
{ {
$this->usernameCanonical = $usernameCanonical; $this->usernameCanonical = $usernameCanonical;
return $this; return $this;
} }
/**
* @return string
*/
public function getUsernameCanonical()
{
return $this->usernameCanonical;
}
/**
* @param $email
* @return $this
*/
public function setEmail($email) public function setEmail($email)
{ {
$this->email = $email; $this->email = $email;
return $this; return $this;
} }
/**
* @return string
*/
public function getEmail()
{
return $this->email;
}
/**
* @param $emailCanonical
* @return $this
*/
public function setEmailCanonical($emailCanonical) public function setEmailCanonical($emailCanonical)
{ {
$this->emailCanonical = $emailCanonical; $this->emailCanonical = $emailCanonical;
return $this; return $this;
} }
/**
* @return string
*/
public function getEmailCanonical()
{
return $this->emailCanonical;
}
/**
* @param $password
* @return $this
*/
function setPassword($password) function setPassword($password)
{ {
$this->password = $password; $this->password = $password;
@ -177,45 +237,50 @@ class User implements AdvancedUserInterface {
return $this; return $this;
} }
/**
* @return string
*/
public function getPassword()
{
return $this->password;
}
/**
* @param $salt
* @return $this
*/
function setSalt($salt) function setSalt($salt)
{ {
$this->salt = $salt; $this->salt = $salt;
return $this; return $this;
} }
/** /**
* {@inheritdoc} * @return bool
*
* @return boolean
*/ */
public function isAccountNonExpired() public function isAccountNonExpired()
{ {
return true; return true;
} }
/** /**
* {@inheritdoc} * @return bool
*
*/ */
public function isAccountNonLocked() public function isAccountNonLocked()
{ {
return $this->locked; return $this->locked;
} }
/** /**
* {@inheritdoc} * @return bool
*
* @return boolean
*/ */
public function isCredentialsNonExpired() public function isCredentialsNonExpired()
{ {
return true; return true;
} }
/** /**
* {@inheritdoc} * @return bool
*
* @return boolean
*/ */
public function isEnabled() public function isEnabled()
{ {
@ -223,7 +288,6 @@ class User implements AdvancedUserInterface {
} }
/** /**
*
* @param bool $enabled * @param bool $enabled
*/ */
public function setEnabled($enabled) public function setEnabled($enabled)
@ -234,8 +298,7 @@ class User implements AdvancedUserInterface {
} }
/** /**
* * @return GroupCenter
* @return GroupCenter[]
*/ */
public function getGroupCenters() public function getGroupCenters()
{ {
@ -243,7 +306,6 @@ class User implements AdvancedUserInterface {
} }
/** /**
*
* @param \Chill\MainBundle\Entity\GroupCenter $groupCenter * @param \Chill\MainBundle\Entity\GroupCenter $groupCenter
* @return \Chill\MainBundle\Entity\User * @return \Chill\MainBundle\Entity\User
*/ */
@ -254,7 +316,6 @@ class User implements AdvancedUserInterface {
} }
/** /**
*
* @param \Chill\MainBundle\Entity\GroupCenter $groupCenter * @param \Chill\MainBundle\Entity\GroupCenter $groupCenter
* @throws \RuntimeException if the groupCenter is not in the collection * @throws \RuntimeException if the groupCenter is not in the collection
*/ */

View File

@ -1,25 +0,0 @@
Chill\MainBundle\Entity\Address:
type: entity
table: chill_main_address
id:
id:
type: integer
id: true
generator:
strategy: AUTO
fields:
streetAddress1:
type: string
length: 255
streetAddress2:
type: string
length: 255
validFrom:
type: date
isNoAddress:
type: boolean
default: false
manyToOne:
postcode:
targetEntity: Chill\MainBundle\Entity\PostalCode
lifecycleCallbacks: { }

View File

@ -1,18 +0,0 @@
Chill\MainBundle\Entity\Center:
type: entity
table: centers
repositoryClass: Chill\MainBundle\Repository\CenterRepository
id:
id:
type: integer
id: true
generator:
strategy: AUTO
fields:
name:
type: string
length: 255
oneToMany:
groupCenters:
targetEntity: Chill\MainBundle\Entity\GroupCenter
mappedBy: groupCenters

View File

@ -1,18 +0,0 @@
Chill\MainBundle\Entity\Country:
type: entity
table: null
cache:
usage: READ_ONLY
region: country_cache_region
fields:
id:
type: integer
id: true
generator:
strategy: AUTO
name:
type: json_array
countryCode:
type: string
length: 3
lifecycleCallbacks: { }

View File

@ -1,26 +0,0 @@
Chill\MainBundle\Entity\GroupCenter:
type: entity
table: group_centers
cache:
usage: NONSTRICT_READ_WRITE
region: acl_cache_region
id:
id:
type: integer
id: true
generator:
strategy: AUTO
manyToOne:
center:
targetEntity: Chill\MainBundle\Entity\Center
inversedBy: groupCenters
cache:
usage: NONSTRICT_READ_WRITE
permissionsGroup:
targetEntity: Chill\MainBundle\Entity\PermissionsGroup
cache:
usage: NONSTRICT_READ_WRITE
manyToMany:
users:
targetEntity: Chill\MainBundle\Entity\User
mappedBy: groupCenters

View File

@ -1,13 +0,0 @@
Chill\MainBundle\Entity\Language:
type: entity
table: null
cache:
usage: READ_ONLY
region: language_cache_region
id:
id:
type: string
fields:
name:
type: json_array
lifecycleCallbacks: { }

View File

@ -1,32 +0,0 @@
Chill\MainBundle\Entity\PermissionsGroup:
type: entity
table: permission_groups
cache:
usage: NONSTRICT_READ_WRITE
region: acl_cache_region
id:
id:
type: integer
id: true
generator:
strategy: AUTO
fields:
name:
type: string
length: 255
flags:
type: json
options:
default: '[]'
manyToMany:
roleScopes:
targetEntity: Chill\MainBundle\Entity\RoleScope
inversedBy: permissionsGroups
cache:
usage: NONSTRICT_READ_WRITE
cascade: [ persist ]
oneToMany:
groupCenters:
targetEntity: Chill\MainBundle\Entity\GroupCenter
mappedBy: permissionsGroup

View File

@ -1,24 +0,0 @@
Chill\MainBundle\Entity\PostalCode:
type: entity
table: chill_main_postal_code
repositoryClass: Chill\MainBundle\Repository\PostalCodeRepository
indexes:
- { name: search_name_code, columns: [ "code", "label" ] }
id:
id:
type: integer
id: true
generator:
strategy: AUTO
fields:
name:
type: string
length: 255
column: label
code:
type: string
length: 100
manyToOne:
country:
targetEntity: Chill\MainBundle\Entity\Country
lifecycleCallbacks: { }

View File

@ -1,28 +0,0 @@
Chill\MainBundle\Entity\RoleScope:
type: entity
table: role_scopes
cache:
usage: NONSTRICT_READ_WRITE
region: acl_cache_region
id:
id:
type: integer
id: true
generator:
strategy: AUTO
fields:
role:
type: string
length: 255
manyToOne:
scope:
targetEntity: Chill\MainBundle\Entity\Scope
inversedBy: roleScopes
nullable: true
cache:
usage: NONSTRICT_READ_WRITE
manyToMany:
permissionsGroups:
targetEntity: Chill\MainBundle\Entity\PermissionsGroup
mappedBy: roleScopes

View File

@ -1,21 +0,0 @@
Chill\MainBundle\Entity\Scope:
type: entity
table: scopes
cache:
usage: NONSTRICT_READ_WRITE
region: acl_cache_region
id:
id:
type: integer
id: true
generator:
strategy: AUTO
fields:
name:
type: json_array
oneToMany:
roleScopes:
targetEntity: Chill\MainBundle\Entity\RoleScope
mappedBy: scope
cache:
usage: NONSTRICT_READ_WRITE

View File

@ -1,53 +0,0 @@
Chill\MainBundle\Entity\User:
type: entity
table: users
repositoryClass: Chill\MainBundle\Repository\UserRepository
cache:
usage: NONSTRICT_READ_WRITE
region: acl_cache_region
id:
id:
type: integer
id: true
generator:
strategy: AUTO
fields:
username:
type: string
length: 80
usernameCanonical:
name: username_canonical
type: string
length: 80
unique: true
email:
type: string
length: 150
nullable: true
emailCanonical:
name: email_canonical
type: string
length: 150
nullable: true
unique: true
password:
type: string
length: 255
salt:
type: string
length: 255
nullable: true
enabled:
type: boolean
default: true
locked:
type: boolean
default: false
manyToMany:
groupCenters:
targetEntity: Chill\MainBundle\Entity\GroupCenter
inversedBy: users
cache:
usage: NONSTRICT_READ_WRITE