fix: update table scheme

This commit is contained in:
Maël Gangloff
2024-07-11 02:29:08 +02:00
parent 9cc575ff09
commit fbb14df399
14 changed files with 711 additions and 56 deletions

View File

@@ -13,6 +13,7 @@
"doctrine/orm": "^3.2",
"phpdocumentor/reflection-docblock": "^5.4",
"phpstan/phpdoc-parser": "^1.29",
"spatie/icalendar-generator": "^2.8",
"symfony/asset": "7.1.*",
"symfony/asset-mapper": "7.1.*",
"symfony/console": "7.1.*",
@@ -38,6 +39,7 @@
"symfony/string": "7.1.*",
"symfony/translation": "7.1.*",
"symfony/twig-bundle": "7.1.*",
"symfony/uid": "7.1.*",
"symfony/ux-turbo": "^2.18",
"symfony/validator": "7.1.*",
"symfony/web-link": "7.1.*",

291
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "6a69bab77db7d87183f93d182e22724e",
"content-hash": "2c9a601dd6b90ee988fc2c8205c79665",
"packages": [
{
"name": "composer/semver",
@@ -2005,6 +2005,142 @@
},
"time": "2021-07-14T16:46:02+00:00"
},
{
"name": "spatie/enum",
"version": "3.13.0",
"source": {
"type": "git",
"url": "https://github.com/spatie/enum.git",
"reference": "f1a0f464ba909491a53e60a955ce84ad7cd93a2c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/enum/zipball/f1a0f464ba909491a53e60a955ce84ad7cd93a2c",
"reference": "f1a0f464ba909491a53e60a955ce84ad7cd93a2c",
"shasum": ""
},
"require": {
"ext-json": "*",
"php": "^8.0"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"larapack/dd": "^1.1",
"phpunit/phpunit": "^9.0",
"vimeo/psalm": "^4.3"
},
"suggest": {
"fakerphp/faker": "To use the enum faker provider",
"phpunit/phpunit": "To use the enum assertions"
},
"type": "library",
"autoload": {
"psr-4": {
"Spatie\\Enum\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Brent Roose",
"email": "brent@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
},
{
"name": "Tom Witkowski",
"email": "dev@gummibeer.de",
"homepage": "https://gummibeer.de",
"role": "Developer"
}
],
"description": "PHP Enums",
"homepage": "https://github.com/spatie/enum",
"keywords": [
"enum",
"enumerable",
"spatie"
],
"support": {
"docs": "https://docs.spatie.be/enum",
"issues": "https://github.com/spatie/enum/issues",
"source": "https://github.com/spatie/enum"
},
"funding": [
{
"url": "https://spatie.be/open-source/support-us",
"type": "custom"
},
{
"url": "https://github.com/spatie",
"type": "github"
}
],
"time": "2022-04-22T08:51:55+00:00"
},
{
"name": "spatie/icalendar-generator",
"version": "2.8.1",
"source": {
"type": "git",
"url": "https://github.com/spatie/icalendar-generator.git",
"reference": "6cb8b9b9df72bbea25b302aabce680917739fdb6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/icalendar-generator/zipball/6cb8b9b9df72bbea25b302aabce680917739fdb6",
"reference": "6cb8b9b9df72bbea25b302aabce680917739fdb6",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"php": "^8.1",
"spatie/enum": "^3.11"
},
"require-dev": {
"ext-json": "*",
"larapack/dd": "^1.1",
"nesbot/carbon": "^3.5",
"pestphp/pest": "^2.34",
"spatie/pest-plugin-snapshots": "^2.1",
"vimeo/psalm": "^5.24"
},
"type": "library",
"autoload": {
"psr-4": {
"Spatie\\IcalendarGenerator\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ruben Van Assche",
"email": "ruben@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
}
],
"description": "Build calendars in the iCalendar format",
"homepage": "https://github.com/spatie/icalendar-generator",
"keywords": [
"calendar",
"iCalendar",
"ical",
"ics",
"spatie"
],
"support": {
"issues": "https://github.com/spatie/icalendar-generator/issues",
"source": "https://github.com/spatie/icalendar-generator/tree/2.8.1"
},
"time": "2024-06-17T11:23:50+00:00"
},
{
"name": "symfony/asset",
"version": "v7.1.1",
@@ -5261,6 +5397,85 @@
],
"time": "2024-06-19T12:35:24+00:00"
},
{
"name": "symfony/polyfill-uuid",
"version": "v1.30.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-uuid.git",
"reference": "2ba1f33797470debcda07fe9dce20a0003df18e9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-uuid/zipball/2ba1f33797470debcda07fe9dce20a0003df18e9",
"reference": "2ba1f33797470debcda07fe9dce20a0003df18e9",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"provide": {
"ext-uuid": "*"
},
"suggest": {
"ext-uuid": "For best performance"
},
"type": "library",
"extra": {
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Uuid\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Grégoire Pineau",
"email": "lyrixx@lyrixx.info"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for uuid functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"uuid"
],
"support": {
"source": "https://github.com/symfony/polyfill-uuid/tree/v1.30.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2024-05-31T15:07:36+00:00"
},
{
"name": "symfony/process",
"version": "v7.1.1",
@@ -6835,6 +7050,80 @@
],
"time": "2024-05-31T14:59:31+00:00"
},
{
"name": "symfony/uid",
"version": "v7.1.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/uid.git",
"reference": "bb59febeecc81528ff672fad5dab7f06db8c8277"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/uid/zipball/bb59febeecc81528ff672fad5dab7f06db8c8277",
"reference": "bb59febeecc81528ff672fad5dab7f06db8c8277",
"shasum": ""
},
"require": {
"php": ">=8.2",
"symfony/polyfill-uuid": "^1.15"
},
"require-dev": {
"symfony/console": "^6.4|^7.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Uid\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Grégoire Pineau",
"email": "lyrixx@lyrixx.info"
},
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Provides an object-oriented API to generate and represent UIDs",
"homepage": "https://symfony.com",
"keywords": [
"UID",
"ulid",
"uuid"
],
"support": {
"source": "https://github.com/symfony/uid/tree/v7.1.1"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2024-05-31T14:57:53+00:00"
},
{
"name": "symfony/ux-turbo",
"version": "v2.18.0",

View File

@@ -4,14 +4,18 @@ security:
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
# https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
providers:
users_in_memory: { memory: null }
# used to reload user from session & other features (e.g. switch_user)
app_user_provider:
entity:
class: App\Entity\User
property: email
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
lazy: true
provider: users_in_memory
provider: app_user_provider
# activate different ways to authenticate
# https://symfony.com/doc/current/security.html#the-firewall

View File

@@ -1,44 +0,0 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20240710222838 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TEMPORARY TABLE __temp__domain_entity AS SELECT domain_id, entity_id, roles FROM domain_entity');
$this->addSql('DROP TABLE domain_entity');
$this->addSql('CREATE TABLE domain_entity (domain_id VARCHAR(255) NOT NULL, entity_id VARCHAR(255) NOT NULL, roles CLOB NOT NULL --(DC2Type:array)
, PRIMARY KEY(domain_id, entity_id), CONSTRAINT FK_614B48A1115F0EE5 FOREIGN KEY (domain_id) REFERENCES domain (ldhname) ON UPDATE NO ACTION ON DELETE NO ACTION NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_614B48A181257D5D FOREIGN KEY (entity_id) REFERENCES entity (handle) ON UPDATE NO ACTION ON DELETE NO ACTION NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO domain_entity (domain_id, entity_id, roles) SELECT domain_id, entity_id, roles FROM __temp__domain_entity');
$this->addSql('DROP TABLE __temp__domain_entity');
$this->addSql('CREATE INDEX IDX_614B48A181257D5D ON domain_entity (entity_id)');
$this->addSql('CREATE INDEX IDX_614B48A1115F0EE5 ON domain_entity (domain_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TEMPORARY TABLE __temp__domain_entity AS SELECT domain_id, entity_id, roles FROM domain_entity');
$this->addSql('DROP TABLE domain_entity');
$this->addSql('CREATE TABLE domain_entity (domain_id VARCHAR(255) NOT NULL, entity_id VARCHAR(255) NOT NULL, roles VARCHAR(255) NOT NULL, PRIMARY KEY(domain_id, entity_id), CONSTRAINT FK_614B48A1115F0EE5 FOREIGN KEY (domain_id) REFERENCES domain (ldhname) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_614B48A181257D5D FOREIGN KEY (entity_id) REFERENCES entity (handle) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO domain_entity (domain_id, entity_id, roles) SELECT domain_id, entity_id, roles FROM __temp__domain_entity');
$this->addSql('DROP TABLE __temp__domain_entity');
$this->addSql('CREATE INDEX IDX_614B48A1115F0EE5 ON domain_entity (domain_id)');
$this->addSql('CREATE INDEX IDX_614B48A181257D5D ON domain_entity (entity_id)');
}
}

View File

@@ -0,0 +1,67 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20240711002439 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE bookmark_domain_list (token VARCHAR(36) NOT NULL, user_id INTEGER NOT NULL, PRIMARY KEY(token), CONSTRAINT FK_F05EDCECA76ED395 FOREIGN KEY (user_id) REFERENCES user (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('CREATE INDEX IDX_F05EDCECA76ED395 ON bookmark_domain_list (user_id)');
$this->addSql('CREATE TABLE domain (ldhname VARCHAR(255) NOT NULL, handle VARCHAR(255) NOT NULL, status CLOB NOT NULL --(DC2Type:simple_array)
, whois_status VARCHAR(255) NOT NULL, PRIMARY KEY(ldhname))');
$this->addSql('CREATE TABLE domain_entity (domain_id VARCHAR(255) NOT NULL, entity_id VARCHAR(255) NOT NULL, roles CLOB NOT NULL --(DC2Type:simple_array)
, PRIMARY KEY(domain_id, entity_id), CONSTRAINT FK_614B48A1115F0EE5 FOREIGN KEY (domain_id) REFERENCES domain (ldhname) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_614B48A181257D5D FOREIGN KEY (entity_id) REFERENCES entity (handle) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('CREATE INDEX IDX_614B48A1115F0EE5 ON domain_entity (domain_id)');
$this->addSql('CREATE INDEX IDX_614B48A181257D5D ON domain_entity (entity_id)');
$this->addSql('CREATE TABLE entity (handle VARCHAR(255) NOT NULL, PRIMARY KEY(handle))');
$this->addSql('CREATE TABLE event ("action" VARCHAR(255) NOT NULL, domain_id VARCHAR(255) NOT NULL, date DATE NOT NULL --(DC2Type:date_immutable)
, PRIMARY KEY("action", domain_id), CONSTRAINT FK_3BAE0AA7115F0EE5 FOREIGN KEY (domain_id) REFERENCES domain (ldhname) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('CREATE INDEX IDX_3BAE0AA7115F0EE5 ON event (domain_id)');
$this->addSql('CREATE TABLE nameserver (handle VARCHAR(255) NOT NULL, ldhname VARCHAR(255) NOT NULL, status CLOB NOT NULL --(DC2Type:array)
, PRIMARY KEY(handle))');
$this->addSql('CREATE TABLE nameserver_entity (nameserver_id VARCHAR(255) NOT NULL, entity_id VARCHAR(255) NOT NULL, roles CLOB NOT NULL --(DC2Type:simple_array)
, status CLOB NOT NULL --(DC2Type:simple_array)
, PRIMARY KEY(nameserver_id, entity_id), CONSTRAINT FK_A269AFB41A555619 FOREIGN KEY (nameserver_id) REFERENCES nameserver (handle) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_A269AFB481257D5D FOREIGN KEY (entity_id) REFERENCES entity (handle) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('CREATE INDEX IDX_A269AFB41A555619 ON nameserver_entity (nameserver_id)');
$this->addSql('CREATE INDEX IDX_A269AFB481257D5D ON nameserver_entity (entity_id)');
$this->addSql('CREATE TABLE user (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, email VARCHAR(180) NOT NULL, roles CLOB NOT NULL --(DC2Type:json)
, password VARCHAR(255) NOT NULL)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_IDENTIFIER_EMAIL ON user (email)');
$this->addSql('CREATE TABLE messenger_messages (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, body CLOB NOT NULL, headers CLOB NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at DATETIME NOT NULL --(DC2Type:datetime_immutable)
, available_at DATETIME NOT NULL --(DC2Type:datetime_immutable)
, delivered_at DATETIME DEFAULT NULL --(DC2Type:datetime_immutable)
)');
$this->addSql('CREATE INDEX IDX_75EA56E0FB7336F0 ON messenger_messages (queue_name)');
$this->addSql('CREATE INDEX IDX_75EA56E0E3BD61CE ON messenger_messages (available_at)');
$this->addSql('CREATE INDEX IDX_75EA56E016BA31DB ON messenger_messages (delivered_at)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE bookmark_domain_list');
$this->addSql('DROP TABLE domain');
$this->addSql('DROP TABLE domain_entity');
$this->addSql('DROP TABLE entity');
$this->addSql('DROP TABLE event');
$this->addSql('DROP TABLE nameserver');
$this->addSql('DROP TABLE nameserver_entity');
$this->addSql('DROP TABLE user');
$this->addSql('DROP TABLE messenger_messages');
}
}

View File

@@ -0,0 +1,74 @@
<?php
namespace App\Entity;
use App\Repository\BookmarkDomainListRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Uid\Uuid;
#[ORM\Entity(repositoryClass: BookmarkDomainListRepository::class)]
class BookmarkDomainList
{
#[ORM\Id]
#[ORM\Column(length: 36)]
private string $token;
#[ORM\ManyToOne(inversedBy: 'bookmarkDomainLists')]
#[ORM\JoinColumn(nullable: false)]
private ?User $user = null;
/**
* @var Collection<int, Domain>
*/
#[ORM\ManyToMany(targetEntity: Domain::class, mappedBy: 'ldhname')]
private Collection $domains;
public function __construct()
{
$this->token = Uuid::v4();
$this->domains = new ArrayCollection();
}
public function getToken(): ?string
{
return $this->token;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): static
{
$this->user = $user;
return $this;
}
/**
* @return Collection<int, Domain>
*/
public function getDomains(): Collection
{
return $this->domains;
}
public function addDomain(Domain $domain): static
{
if (!$this->domains->contains($domain)) {
$this->domains->add($domain);
}
return $this;
}
public function removeDomain(Domain $domain): static
{
$this->domains->removeElement($domain);
return $this;
}
}

View File

@@ -18,7 +18,7 @@ class Domain
#[ORM\Column(length: 255)]
private ?string $handle = null;
#[ORM\Column(type: Types::ARRAY)]
#[ORM\Column(type: Types::SIMPLE_ARRAY)]
private array $status = [];
/**

View File

@@ -11,15 +11,15 @@ class DomainEntity
{
#[ORM\Id]
#[ORM\ManyToOne(inversedBy: 'domainEntities')]
#[ORM\JoinColumn(nullable: false, referencedColumnName: 'ldhname')]
#[ORM\JoinColumn(referencedColumnName: 'ldhname', nullable: false)]
private ?Domain $domain = null;
#[ORM\Id]
#[ORM\ManyToOne(inversedBy: 'domainEntities')]
#[ORM\JoinColumn(nullable: false, referencedColumnName: 'handle')]
#[ORM\JoinColumn(referencedColumnName: 'handle', nullable: false)]
private ?Entity $entity = null;
#[ORM\Column(type: Types::ARRAY)]
#[ORM\Column(type: Types::SIMPLE_ARRAY)]
private array $roles = [];
public function getDomain(): ?Domain

View File

@@ -18,7 +18,7 @@ class Event
#[ORM\Id]
#[ORM\ManyToOne(inversedBy: 'events')]
#[ORM\JoinColumn(nullable: false, referencedColumnName: 'ldhname')]
#[ORM\JoinColumn(referencedColumnName: 'ldhname', nullable: false)]
private ?Domain $domain = null;
public function getAction(): ?string

View File

@@ -11,18 +11,18 @@ class NameserverEntity
{
#[ORM\Id]
#[ORM\ManyToOne(inversedBy: 'nameserverEntities')]
#[ORM\JoinColumn(nullable: false, referencedColumnName: 'handle')]
#[ORM\JoinColumn(referencedColumnName: 'handle', nullable: false)]
private ?Nameserver $nameserver = null;
#[ORM\Id]
#[ORM\ManyToOne(inversedBy: 'nameserverEntities')]
#[ORM\JoinColumn(nullable: false, referencedColumnName: 'handle')]
#[ORM\JoinColumn(referencedColumnName: 'handle', nullable: false)]
private ?Entity $entity = null;
#[ORM\Column(type: Types::ARRAY)]
#[ORM\Column(type: Types::SIMPLE_ARRAY)]
private array $roles = [];
#[ORM\Column(type: Types::ARRAY)]
#[ORM\Column(type: Types::SIMPLE_ARRAY)]
private array $status = [];
public function getNameserver(): ?Nameserver

151
src/Entity/User.php Normal file
View File

@@ -0,0 +1,151 @@
<?php
namespace App\Entity;
use App\Repository\UserRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
#[ORM\Entity(repositoryClass: UserRepository::class)]
#[ORM\UniqueConstraint(name: 'UNIQ_IDENTIFIER_EMAIL', fields: ['email'])]
class User implements UserInterface, PasswordAuthenticatedUserInterface
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 180)]
private ?string $email = null;
/**
* @var list<string> The user roles
*/
#[ORM\Column]
private array $roles = [];
/**
* @var string The hashed password
*/
#[ORM\Column]
private ?string $password = null;
/**
* @var Collection<int, BookmarkDomainList>
*/
#[ORM\OneToMany(targetEntity: BookmarkDomainList::class, mappedBy: 'user', orphanRemoval: true)]
private Collection $bookmarkDomainLists;
public function __construct()
{
$this->bookmarkDomainLists = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(string $email): static
{
$this->email = $email;
return $this;
}
/**
* A visual identifier that represents this user.
*
* @see UserInterface
*/
public function getUserIdentifier(): string
{
return (string) $this->email;
}
/**
* @see UserInterface
*
* @return list<string>
*/
public function getRoles(): array
{
$roles = $this->roles;
// guarantee every user at least has ROLE_USER
$roles[] = 'ROLE_USER';
return array_unique($roles);
}
/**
* @param list<string> $roles
*/
public function setRoles(array $roles): static
{
$this->roles = $roles;
return $this;
}
/**
* @see PasswordAuthenticatedUserInterface
*/
public function getPassword(): string
{
return $this->password;
}
public function setPassword(string $password): static
{
$this->password = $password;
return $this;
}
/**
* @see UserInterface
*/
public function eraseCredentials(): void
{
// If you store any temporary, sensitive data on the user, clear it here
// $this->plainPassword = null;
}
/**
* @return Collection<int, BookmarkDomainList>
*/
public function getBookmarkDomainLists(): Collection
{
return $this->bookmarkDomainLists;
}
public function addBookmarkDomainList(BookmarkDomainList $bookmarkDomainList): static
{
if (!$this->bookmarkDomainLists->contains($bookmarkDomainList)) {
$this->bookmarkDomainLists->add($bookmarkDomainList);
$bookmarkDomainList->setUser($this);
}
return $this;
}
public function removeBookmarkDomainList(BookmarkDomainList $bookmarkDomainList): static
{
if ($this->bookmarkDomainLists->removeElement($bookmarkDomainList)) {
// set the owning side to null (unless already changed)
if ($bookmarkDomainList->getUser() === $this) {
$bookmarkDomainList->setUser(null);
}
}
return $this;
}
}

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\BookmarkDomainList;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<BookmarkDomainList>
*/
class BookmarkDomainListRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, BookmarkDomainList::class);
}
// /**
// * @return BookmarkDomainList[] Returns an array of BookmarkDomainList objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('b')
// ->andWhere('b.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('b.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?BookmarkDomainList
// {
// return $this->createQueryBuilder('b')
// ->andWhere('b.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@@ -0,0 +1,60 @@
<?php
namespace App\Repository;
use App\Entity\User;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
/**
* @extends ServiceEntityRepository<User>
*/
class UserRepository extends ServiceEntityRepository implements PasswordUpgraderInterface
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, User::class);
}
/**
* Used to upgrade (rehash) the user's password automatically over time.
*/
public function upgradePassword(PasswordAuthenticatedUserInterface $user, string $newHashedPassword): void
{
if (!$user instanceof User) {
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', $user::class));
}
$user->setPassword($newHashedPassword);
$this->getEntityManager()->persist($user);
$this->getEntityManager()->flush();
}
// /**
// * @return User[] Returns an array of User objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('u')
// ->andWhere('u.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('u.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?User
// {
// return $this->createQueryBuilder('u')
// ->andWhere('u.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@@ -248,6 +248,15 @@
"templates/base.html.twig"
]
},
"symfony/uid": {
"version": "7.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "7.0",
"ref": "0df5844274d871b37fc3816c57a768ffc60a43a5"
}
},
"symfony/ux-turbo": {
"version": "v2.18.0"
},