infinito/application/src/Entity/User.php

49 lines
1.3 KiB
PHP
Raw Normal View History

2018-09-05 15:46:14 +02:00
<?php
2018-09-12 22:25:22 +02:00
2018-09-05 15:46:14 +02:00
namespace App\Entity;
2018-09-06 14:03:08 +02:00
use Doctrine\ORM\Mapping as ORM;
2018-09-13 02:24:25 +02:00
use FOS\UserBundle\Model\User as BaseUser;
2018-09-13 14:39:03 +02:00
use App\Entity\Attribut\SourceAttributInterface;
use App\Entity\Attribut\SourceAttribut;
use App\Entity\Attribut\IdAttribut;
2018-09-21 16:27:49 +02:00
use App\Creator\Modificator\Entity\LawModificator;
2018-09-06 15:14:33 +02:00
2018-09-05 15:46:14 +02:00
/**
* @author kevinfrantz
2018-09-13 14:39:03 +02:00
* @ORM\Table(name="user")
2018-09-06 11:57:32 +02:00
* @ORM\Entity(repositoryClass="App\Repository\UserRepository")
2018-09-05 15:46:14 +02:00
*/
2018-09-13 14:39:03 +02:00
class User extends BaseUser implements SourceAttributInterface
2018-09-05 15:46:14 +02:00
{
2018-09-13 14:39:03 +02:00
use SourceAttribut,IdAttribut;
2018-09-12 22:25:22 +02:00
2018-09-13 14:39:03 +02:00
/**
* @var UserSourceInterface
* @ORM\OneToOne(targetEntity="UserSource",cascade={"persist", "remove"})
* @ORM\JoinColumn(name="source_user_id", referencedColumnName="id")
*/
protected $source;
2018-09-13 16:51:58 +02:00
2018-09-06 11:57:32 +02:00
/**
* @ORM\Column(name="is_active", type="boolean")
*/
private $isActive;
2018-09-13 02:24:25 +02:00
/**
* @ORM\Id()
* @ORM\GeneratedValue
* @ORM\Column(type="integer")(strategy="AUTO")
*/
protected $id;
2018-09-06 11:57:32 +02:00
2018-09-13 02:24:25 +02:00
public function __construct()
2018-09-06 11:57:32 +02:00
{
parent::__construct();
2018-09-13 02:24:25 +02:00
$this->isActive = true;
2018-09-13 14:39:03 +02:00
$this->source = new UserSource();
2018-09-21 16:27:49 +02:00
LawModificator::grantAllRights($this->source->getNode()->getLaw(), $this->source->getNode());
2018-09-21 19:43:48 +02:00
//var_dump($this->source->getNode()->getLaw()->getRights()->get(0));
2018-09-06 11:57:32 +02:00
}
}