fix: Strict type RoleScope.

This commit is contained in:
Pol Dellaiera 2021-11-18 14:29:11 +01:00
parent 162db60f59
commit ae79ebc299
No known key found for this signature in database
GPG Key ID: D476DFE9C67467CA

View File

@ -1,5 +1,7 @@
<?php <?php
declare(strict_types=1);
namespace Chill\MainBundle\Entity; namespace Chill\MainBundle\Entity;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
@ -18,12 +20,12 @@ class RoleScope
* @ORM\Column(name="id", type="integer") * @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO") * @ORM\GeneratedValue(strategy="AUTO")
*/ */
private int $id; private ?int $id = null;
/** /**
* @ORM\Column(type="string", length=255) * @ORM\Column(type="string", length=255)
*/ */
private string $role; private ?string $role = null;
/** /**
* @ORM\ManyToOne( * @ORM\ManyToOne(
@ -32,7 +34,7 @@ class RoleScope
* @ORM\JoinColumn(nullable=true, name="scope_id") * @ORM\JoinColumn(nullable=true, name="scope_id")
* @ORM\Cache(usage="NONSTRICT_READ_WRITE") * @ORM\Cache(usage="NONSTRICT_READ_WRITE")
*/ */
private ?Scope $scope; private ?Scope $scope = null;
/** /**
* @var Collection * @var Collection
@ -43,53 +45,33 @@ class RoleScope
*/ */
private $permissionsGroups; private $permissionsGroups;
private bool $new;
public function __construct() { public function __construct() {
$this->new = true;
$this->permissionsGroups = new ArrayCollection(); $this->permissionsGroups = new ArrayCollection();
} }
/** public function getId(): ?int
* @return int
*/
public function getId()
{ {
return $this->id; return $this->id;
} }
/** public function getRole(): ?string
* @return string
*/
public function getRole()
{ {
return $this->role; return $this->role;
} }
/** public function getScope(): ?Scope
* @return Scope
*/
public function getScope()
{ {
return $this->scope; return $this->scope;
} }
/** public function setRole(?string $role = null): self
* @param type $role
* @return RoleScope
*/
public function setRole($role)
{ {
$this->role = $role; $this->role = $role;
return $this; return $this;
} }
/** public function setScope(?Scope $scope = null): self
* @param Scope $scope
* @return RoleScope
*/
public function setScope(Scope $scope = null)
{ {
$this->scope = $scope; $this->scope = $scope;