-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
725 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?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 Version20240212183141 extends AbstractMigration | ||
{ | ||
public function getDescription(): string | ||
{ | ||
return 'Symfony 7 update, with new entities n so on.'; | ||
} | ||
|
||
public function up(Schema $schema): void | ||
{ | ||
// this up() migration is auto-generated, please modify it to your needs | ||
$this->addSql('CREATE TABLE footer_link (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, url VARCHAR(255) NOT NULL, title VARCHAR(255) NOT NULL, priority SMALLINT NOT NULL, PRIMARY KEY(id))'); | ||
$this->addSql('CREATE TABLE link_block (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, title VARCHAR(255) NOT NULL, description VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))'); | ||
$this->addSql('CREATE TABLE sub_link_block (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, url VARCHAR(255) NOT NULL, title VARCHAR(255) NOT NULL, link_block_id INT NOT NULL, PRIMARY KEY(id))'); | ||
$this->addSql('CREATE INDEX IDX_6B58312447E2C5 ON sub_link_block (link_block_id)'); | ||
$this->addSql('ALTER TABLE sub_link_block ADD CONSTRAINT FK_6B58312447E2C5 FOREIGN KEY (link_block_id) REFERENCES link_block (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); | ||
$this->addSql('ALTER TABLE mascot_group ALTER id ADD GENERATED BY DEFAULT AS IDENTITY'); | ||
$this->addSql('ALTER TABLE mascot_group ALTER directories TYPE JSON USING (directories::JSON)'); | ||
$this->addSql('COMMENT ON COLUMN mascot_group.directories IS \'\''); | ||
$this->addSql('ALTER TABLE rss__group ALTER id ADD GENERATED BY DEFAULT AS IDENTITY'); | ||
$this->addSql('ALTER TABLE rss__result ADD created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL'); | ||
$this->addSql('ALTER TABLE rss__result ALTER id ADD GENERATED BY DEFAULT AS IDENTITY'); | ||
$this->addSql('ALTER TABLE rss__result ALTER seen_at TYPE TIMESTAMP(0) WITHOUT TIME ZONE'); | ||
$this->addSql('COMMENT ON COLUMN rss__result.seen_at IS \'\''); | ||
$this->addSql('ALTER TABLE rss__search ALTER id ADD GENERATED BY DEFAULT AS IDENTITY'); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
// this down() migration is auto-generated, please modify it to your needs | ||
$this->addSql('CREATE SCHEMA public'); | ||
$this->addSql('ALTER TABLE sub_link_block DROP CONSTRAINT FK_6B58312447E2C5'); | ||
$this->addSql('DROP TABLE footer_link'); | ||
$this->addSql('DROP TABLE link_block'); | ||
$this->addSql('DROP TABLE sub_link_block'); | ||
$this->addSql('ALTER TABLE mascot_group ALTER id DROP IDENTITY'); | ||
$this->addSql('ALTER TABLE mascot_group ALTER directories TYPE TEXT'); | ||
$this->addSql('COMMENT ON COLUMN mascot_group.directories IS \'(DC2Type:array)\''); | ||
$this->addSql('ALTER TABLE rss__group ALTER id DROP IDENTITY'); | ||
$this->addSql('ALTER TABLE rss__search ALTER id DROP IDENTITY'); | ||
$this->addSql('ALTER TABLE rss__result DROP created_at'); | ||
$this->addSql('ALTER TABLE rss__result ALTER id DROP IDENTITY'); | ||
$this->addSql('ALTER TABLE rss__result ALTER seen_at TYPE DATE'); | ||
$this->addSql('COMMENT ON COLUMN rss__result.seen_at IS \'(DC2Type:date_immutable)\''); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace App\Controller\Admin; | ||
|
||
use App\Entity\FooterLink; | ||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; | ||
use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; | ||
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; | ||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | ||
|
||
class FooterLinkCrudController extends AbstractCrudController | ||
{ | ||
#[\Override] | ||
public static function getEntityFqcn(): string | ||
{ | ||
return FooterLink::class; | ||
} | ||
|
||
#[\Override] | ||
public function configureFields(string $pageName): iterable | ||
{ | ||
yield IdField::new('id') | ||
->hideOnForm(); | ||
|
||
yield TextField::new('url'); | ||
yield TextField::new('title'); | ||
yield NumberField::new('priority'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace App\Controller\Admin; | ||
|
||
use App\Entity\LinkBlock; | ||
use App\Form\SubLinkBlockType; | ||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; | ||
use EasyCorp\Bundle\EasyAdminBundle\Field\CollectionField; | ||
use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; | ||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | ||
|
||
class LinkBlockCrudController extends AbstractCrudController | ||
{ | ||
|
||
#[\Override] | ||
public static function getEntityFqcn(): string | ||
{ | ||
return LinkBlock::class; | ||
} | ||
|
||
#[\Override] | ||
public function configureFields(string $pageName): iterable | ||
{ | ||
yield IdField::new('id') | ||
->hideOnForm(); | ||
|
||
yield TextField::new('title'); | ||
yield TextField::new('description'); | ||
yield CollectionField::new('subLinkBlocks') | ||
->setEntryType(SubLinkBlockType::class) | ||
->setFormTypeOption('by_reference', false) | ||
->allowAdd() | ||
->allowDelete(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
|
||
namespace App\Entity; | ||
|
||
use App\Repository\FooterLinkRepository; | ||
use Doctrine\DBAL\Types\Types; | ||
use Doctrine\ORM\Mapping as ORM; | ||
use Symfony\Component\Serializer\Attribute\Groups; | ||
|
||
#[ORM\Entity(repositoryClass: FooterLinkRepository::class)] | ||
class FooterLink | ||
{ | ||
#[ORM\Id] | ||
#[ORM\GeneratedValue] | ||
#[ORM\Column] | ||
private int|null $id = null; | ||
|
||
#[ORM\Column(length: 255)] | ||
#[Groups('api')] | ||
private string|null $url = null; | ||
|
||
#[ORM\Column(length: 255)] | ||
#[Groups('api')] | ||
private string|null $title = null; | ||
|
||
#[ORM\Column(type: Types::SMALLINT)] | ||
private int|null $priority = null; | ||
|
||
public function getId(): int|null | ||
{ | ||
return $this->id; | ||
} | ||
|
||
public function getUrl(): string|null | ||
{ | ||
return $this->url; | ||
} | ||
|
||
public function setUrl( | ||
string $url | ||
): static { | ||
$this->url = $url; | ||
|
||
return $this; | ||
} | ||
|
||
public function getTitle(): string|null | ||
{ | ||
return $this->title; | ||
} | ||
|
||
public function setTitle( | ||
string $title | ||
): static { | ||
$this->title = $title; | ||
|
||
return $this; | ||
} | ||
|
||
public function getPriority(): int|null | ||
{ | ||
return $this->priority; | ||
} | ||
|
||
public function setPriority( | ||
int $priority | ||
): static { | ||
$this->priority = $priority; | ||
|
||
return $this; | ||
} | ||
} |
Oops, something went wrong.