DataDomain changes
This commit is contained in:
parent
cfa750aff2
commit
8ca2d350e8
@ -1,20 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Template\Data\Business\Entity\User;
|
use Template\Data\Business\Entity\User;
|
||||||
use Template\Data\Business\Factory\EntityManagerFactory;
|
use Template\Data\Business\Factory\EntityManagerFactory as TemplateEntityManagerFactory;
|
||||||
use Template\Data\Business\Manager\EntityManager;
|
use Template\Data\Business\Manager\EntityManager;
|
||||||
use Template\Data\Business\Repository\UserRepository;
|
use Template\Data\Business\Repository\UserRepository;
|
||||||
use Template\Infrastructure\Database\AutowireRepositoryFactory;
|
use Template\Infrastructure\Database\AutowireRepositoryFactory;
|
||||||
use Roave\PsrContainerDoctrine\ConfigurationFactory;
|
use Roave\PsrContainerDoctrine\ConfigurationFactory;
|
||||||
use Roave\PsrContainerDoctrine\ConnectionFactory;
|
use Roave\PsrContainerDoctrine\ConnectionFactory;
|
||||||
use Roave\PsrContainerDoctrine\EntityManagerFactory as BaseEntityManagerFactory;
|
use Roave\PsrContainerDoctrine\EntityManagerFactory;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'factories' => [
|
'factories' => [
|
||||||
'doctrine.entity_manager.orm_template' => [BaseEntityManagerFactory::class, 'orm_template'],
|
'doctrine.entity_manager.orm_template' => [EntityManagerFactory::class, 'orm_template'],
|
||||||
'doctrine.configuration.orm_template' => [ConfigurationFactory::class, 'orm_template'],
|
'doctrine.configuration.orm_template' => [ConfigurationFactory::class, 'orm_template'],
|
||||||
'doctrine.connection.orm_template' => [ConnectionFactory::class, 'orm_template'],
|
'doctrine.connection.orm_template' => [ConnectionFactory::class, 'orm_template'],
|
||||||
EntityManager::class => EntityManagerFactory::class,
|
EntityManager::class => TemplateEntityManagerFactory::class,
|
||||||
|
|
||||||
UserRepository::class => [AutowireRepositoryFactory::class, EntityManager::class, User::class],
|
UserRepository::class => [AutowireRepositoryFactory::class, EntityManager::class, User::class],
|
||||||
],
|
],
|
||||||
|
|||||||
125
src/DataDomain/Business/src/Entity/Mail.php
Normal file
125
src/DataDomain/Business/src/Entity/Mail.php
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Template\Data\Business\Entity;
|
||||||
|
|
||||||
|
use DateTime;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use Template\Infrastructure\UuidGenerator\UuidGenerator;
|
||||||
|
use Ramsey\Uuid\UuidInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Entity(repositoryClass="Template\Data\Business\Repository\MailRepository")
|
||||||
|
* @ORM\Table(name="mail")
|
||||||
|
*/
|
||||||
|
class Mail {
|
||||||
|
/**
|
||||||
|
* @ORM\Id
|
||||||
|
* @ORM\Column(name="id", type="uuid_binary_ordered_time")
|
||||||
|
*/
|
||||||
|
private UuidInterface $id;
|
||||||
|
|
||||||
|
/** @ORM\Column(name="template", type="string") */
|
||||||
|
private string $template;
|
||||||
|
|
||||||
|
/** @ORM\Column(name="data", type="json") */
|
||||||
|
private array $data;
|
||||||
|
|
||||||
|
/** @ORM\Column(name="recipient", type="string") */
|
||||||
|
private string $recipient;
|
||||||
|
|
||||||
|
/** @ORM\Column(name="sender", type="string", nullable="true") */
|
||||||
|
private ?string $sender;
|
||||||
|
|
||||||
|
/** @ORM\Column(name="sender_name", type="string", nullable="true") */
|
||||||
|
private ?string $senderName;
|
||||||
|
|
||||||
|
/** @ORM\Column(name="failed_at", type="datetime", nullable="true") */
|
||||||
|
private ?DateTime $failedAt;
|
||||||
|
|
||||||
|
/** @ORM\Column(name="created_at", type="datetime") */
|
||||||
|
private DateTime $createdAt;
|
||||||
|
|
||||||
|
public function __construct() {
|
||||||
|
$this->id = UuidGenerator::generate();
|
||||||
|
|
||||||
|
$now = new DateTime();
|
||||||
|
$this->setCreatedAt($now);
|
||||||
|
$this->setFailedAt(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\PrePersist
|
||||||
|
* @ORM\PreUpdate
|
||||||
|
*/
|
||||||
|
public function updateTimestamps(): void {
|
||||||
|
$now = new DateTime();
|
||||||
|
//$this->setUpdatedAt($now);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getId(): UuidInterface {
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTemplate(): string
|
||||||
|
{
|
||||||
|
return $this->template;
|
||||||
|
}
|
||||||
|
public function setTemplate(string $template): void
|
||||||
|
{
|
||||||
|
$this->template = $template;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getData(): array
|
||||||
|
{
|
||||||
|
return $this->data;
|
||||||
|
}
|
||||||
|
public function setData(array $data): void
|
||||||
|
{
|
||||||
|
$this->data = $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRecipient(): string
|
||||||
|
{
|
||||||
|
return $this->recipient;
|
||||||
|
}
|
||||||
|
public function setRecipient(string $recipient): void
|
||||||
|
{
|
||||||
|
$this->recipient = $recipient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSender(): ?string
|
||||||
|
{
|
||||||
|
return $this->sender;
|
||||||
|
}
|
||||||
|
public function setSender(?string $sender): void
|
||||||
|
{
|
||||||
|
$this->sender = $sender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSenderName(): ?string
|
||||||
|
{
|
||||||
|
return $this->senderName;
|
||||||
|
}
|
||||||
|
public function setSenderName(?string $senderName): void
|
||||||
|
{
|
||||||
|
$this->senderName = $senderName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFailedAt(): ?DateTime
|
||||||
|
{
|
||||||
|
return $this->failedAt;
|
||||||
|
}
|
||||||
|
public function setFailedAt(?DateTime $failedAt): void
|
||||||
|
{
|
||||||
|
$this->failedAt = $failedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCreatedAt(): DateTime {
|
||||||
|
return $this->createdAt;
|
||||||
|
}
|
||||||
|
public function setCreatedAt(DateTime $createdAt): void {
|
||||||
|
$this->createdAt = $createdAt;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -3,6 +3,8 @@
|
|||||||
namespace Template\Data\Business\Entity;
|
namespace Template\Data\Business\Entity;
|
||||||
|
|
||||||
use DateTime;
|
use DateTime;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Template\Infrastructure\UuidGenerator\UuidGenerator;
|
use Template\Infrastructure\UuidGenerator\UuidGenerator;
|
||||||
use Ramsey\Uuid\UuidInterface;
|
use Ramsey\Uuid\UuidInterface;
|
||||||
@ -39,8 +41,11 @@ class User {
|
|||||||
/** @ORM\OneToOne(targetEntity="Template\Data\Business\Entity\UserSession", mappedBy="user") */
|
/** @ORM\OneToOne(targetEntity="Template\Data\Business\Entity\UserSession", mappedBy="user") */
|
||||||
private ?UserSession $session;
|
private ?UserSession $session;
|
||||||
|
|
||||||
|
/* @ORM\OneToMany(targetEntity="Bee\Data\Business\Entity\UserPasswordToken", mappedBy="user") */
|
||||||
|
private Collection $passwordTokens;
|
||||||
|
|
||||||
/** @ORM\Column(name="last_login_at", type="datetime", nullable=true) */
|
/** @ORM\Column(name="last_login_at", type="datetime", nullable=true) */
|
||||||
private DateTime $lastLoginAt;
|
private ?DateTime $lastLoginAt;
|
||||||
|
|
||||||
/** @ORM\Column(name="created_at", type="datetime") */
|
/** @ORM\Column(name="created_at", type="datetime") */
|
||||||
private DateTime $createdAt;
|
private DateTime $createdAt;
|
||||||
@ -52,6 +57,8 @@ class User {
|
|||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->id = UuidGenerator::generate();
|
$this->id = UuidGenerator::generate();
|
||||||
|
|
||||||
|
$this->passwordTokens = new ArrayCollection();
|
||||||
|
|
||||||
$now = new DateTime();
|
$now = new DateTime();
|
||||||
$this->setCreatedAt($now);
|
$this->setCreatedAt($now);
|
||||||
$this->setUpdatedAt($now);
|
$this->setUpdatedAt($now);
|
||||||
@ -143,6 +150,27 @@ class User {
|
|||||||
public function setUpdatedAt(DateTime $updatedAt): void {
|
public function setUpdatedAt(DateTime $updatedAt): void {
|
||||||
$this->updatedAt = $updatedAt;
|
$this->updatedAt = $updatedAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPasswordTokens(): Collection
|
||||||
|
{
|
||||||
|
return $this->passwordTokens;
|
||||||
|
}
|
||||||
|
public function setPasswordTokens(Collection $passwordTokens): void
|
||||||
|
{
|
||||||
|
$this->passwordTokens = $passwordTokens;
|
||||||
|
}
|
||||||
|
public function addPasswordToken(UserPasswordToken $passwordToken): void
|
||||||
|
{
|
||||||
|
if (!$this->passwordTokens->contains($passwordToken)) {
|
||||||
|
$this->passwordTokens->add($passwordToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function removePasswordToken(UserPasswordToken $passwordToken): void
|
||||||
|
{
|
||||||
|
if ($this->passwordTokens->contains($passwordToken)) {
|
||||||
|
$this->passwordTokens->removeElement($passwordToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
91
src/DataDomain/Business/src/Entity/UserPasswordToken.php
Normal file
91
src/DataDomain/Business/src/Entity/UserPasswordToken.php
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Template\Data\Business\Entity;
|
||||||
|
|
||||||
|
use DateTime;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use Template\Infrastructure\UuidGenerator\UuidGenerator;
|
||||||
|
use Ramsey\Uuid\UuidInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Entity(repositoryClass="Template\Data\Business\Repository\UserPasswordTokenRepository")
|
||||||
|
* @ORM\Table(name="user_password_token")
|
||||||
|
*/
|
||||||
|
class UserPasswordToken {
|
||||||
|
/**
|
||||||
|
* @ORM\Id
|
||||||
|
* @ORM\Column(name="id", type="uuid_binary_ordered_time")
|
||||||
|
*/
|
||||||
|
private UuidInterface $id;
|
||||||
|
|
||||||
|
/** @ORM\Column(name="user_id", type="uuid_binary_ordered_time", nullable=false) */
|
||||||
|
private UuidInterface $userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="User", inversedBy="passwordTokens")
|
||||||
|
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
|
||||||
|
*/
|
||||||
|
private User $user;
|
||||||
|
|
||||||
|
/** @ORM\Column(name="created_at", type="datetime") */
|
||||||
|
private DateTime $createdAt;
|
||||||
|
|
||||||
|
/** @ORM\Column(name="updated_at", type="datetime") */
|
||||||
|
private DateTime $updatedAt;
|
||||||
|
|
||||||
|
|
||||||
|
public function __construct() {
|
||||||
|
$this->id = UuidGenerator::generate();
|
||||||
|
|
||||||
|
$now = new DateTime();
|
||||||
|
$this->setCreatedAt($now);
|
||||||
|
$this->setUpdatedAt($now);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\PrePersist
|
||||||
|
* @ORM\PreUpdate
|
||||||
|
*/
|
||||||
|
public function updateTimestamps(): void {
|
||||||
|
$now = new DateTime();
|
||||||
|
$this->setUpdatedAt($now);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getId(): UuidInterface {
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUserId(): UuidInterface {
|
||||||
|
return $this->userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUserId(UuidInterface $userId): void {
|
||||||
|
$this->userId = $userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUser(): User {
|
||||||
|
return $this->user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUser(User $user): void {
|
||||||
|
$this->user = $user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCreatedAt(): DateTime {
|
||||||
|
return $this->createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCreatedAt(DateTime $createdAt): void {
|
||||||
|
$this->createdAt = $createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUpdatedAt(): DateTime {
|
||||||
|
return $this->updatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUpdatedAt(DateTime $updatedAt): void {
|
||||||
|
$this->updatedAt = $updatedAt;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Template\Data\Business\Repository;
|
||||||
|
|
||||||
|
use Doctrine\ORM\EntityRepository;
|
||||||
|
|
||||||
|
class MailRepository extends EntityRepository {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Template\Data\Business\Repository;
|
||||||
|
|
||||||
|
use Template\Data\Business\Entity\User;
|
||||||
|
use Doctrine\ORM\EntityRepository;
|
||||||
|
use Template\Data\Business\Entity\UserSession;
|
||||||
|
|
||||||
|
class UserPasswordTokenRepository extends EntityRepository {
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user