infinito/application/symfony/src/Entity/User.php

60 lines
1.4 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;
2019-01-20 10:41:58 +01:00
use App\Attribut\SourceAttribut;
use App\Attribut\IdAttribut;
2018-11-21 17:55:48 +01:00
use App\Entity\Source\Complex\UserSourceInterface;
use App\Entity\Source\Complex\UserSource;
2019-01-20 10:41:58 +01:00
use App\Attribut\VersionAttribut;
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-24 18:41:26 +02:00
class User extends BaseUser implements UserInterface
2018-09-05 15:46:14 +02:00
{
2018-10-25 20:42:52 +02:00
use SourceAttribut,IdAttribut, VersionAttribut;
2018-09-12 22:25:22 +02:00
2018-09-13 14:39:03 +02:00
/**
* @var UserSourceInterface
2018-11-21 17:55:48 +01:00
* @ORM\OneToOne(targetEntity="App\Entity\Source\Complex\UserSource",cascade={"persist", "remove"})
* @ORM\JoinColumn(name="source_user_id", referencedColumnName="id", onDelete="CASCADE")
2018-09-13 14:39:03 +02:00
*/
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-10-29 19:01:00 +01:00
2018-10-25 20:42:52 +02:00
/**
* @version @ORM\Column(type="integer")
2018-10-29 19:01:00 +01:00
*
2018-10-25 20:42:52 +02:00
* @var int
*/
protected $version;
2018-09-06 11:57:32 +02:00
/**
* @todo Initialize all needed attributs
*/
2018-09-13 02:24:25 +02:00
public function __construct()
2018-09-06 11:57:32 +02:00
{
parent::__construct();
$this->version = 0;
2018-09-13 02:24:25 +02:00
$this->isActive = true;
2018-09-13 14:39:03 +02:00
$this->source = new UserSource();
2018-11-04 12:40:57 +01:00
$this->source->setUser($this);
2018-09-06 11:57:32 +02:00
}
}