###< symfony/phpunit-bridge ### | ###< symfony/phpunit-bridge ### | ||||
/Lc/* | /Lc/* | ||||
/.idea/* | |||||
/.idea/ |
"doctrine/doctrine-bundle": "^2.2", | "doctrine/doctrine-bundle": "^2.2", | ||||
"doctrine/doctrine-migrations-bundle": "^3.0", | "doctrine/doctrine-migrations-bundle": "^3.0", | ||||
"doctrine/orm": "^2.8", | "doctrine/orm": "^2.8", | ||||
"easycorp/easyadmin-bundle": "^3.1", | |||||
"friendsofsymfony/ckeditor-bundle": "^2.2", | |||||
"phpdocumentor/reflection-docblock": "^5.2", | "phpdocumentor/reflection-docblock": "^5.2", | ||||
"sensio/framework-extra-bundle": "^5.1", | "sensio/framework-extra-bundle": "^5.1", | ||||
"stof/doctrine-extensions-bundle": "^1.5", | |||||
"symfony/asset": "5.2.*", | "symfony/asset": "5.2.*", | ||||
"symfony/console": "5.2.*", | "symfony/console": "5.2.*", | ||||
"symfony/dotenv": "5.2.*", | "symfony/dotenv": "5.2.*", | ||||
"symfony/web-link": "5.2.*", | "symfony/web-link": "5.2.*", | ||||
"symfony/yaml": "5.2.*", | "symfony/yaml": "5.2.*", | ||||
"twig/extra-bundle": "^2.12|^3.0", | "twig/extra-bundle": "^2.12|^3.0", | ||||
"twig/twig": "^2.12|^3.0" | |||||
"twig/twig": "^2.12|^3.0", | |||||
"easycorp/easyadmin-bundle": "dev-master", | |||||
"artgris/filemanager-bundle": "^2.2", | |||||
"friendsofsymfony/ckeditor-bundle": "^2.2", | |||||
"stof/doctrine-extensions-bundle": "^1.5" | |||||
}, | }, | ||||
"require-dev": { | "require-dev": { | ||||
"symfony/browser-kit": "^5.2", | "symfony/browser-kit": "^5.2", |
<?php | <?php | ||||
return [ | return [ | ||||
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], | |||||
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true], | |||||
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], | |||||
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], | |||||
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], | |||||
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], | |||||
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true], | |||||
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], | |||||
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], | |||||
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true], | |||||
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], | |||||
EasyCorp\Bundle\EasyAdminBundle\EasyAdminBundle::class => ['all' => true], | |||||
FOS\CKEditorBundle\FOSCKEditorBundle::class => ['all' => true], | |||||
Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true], | |||||
Lc\AdminBundle\LcAdminBundle::class => ['all' => true], | |||||
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], | |||||
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true], | |||||
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], | |||||
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], | |||||
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], | |||||
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], | |||||
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true], | |||||
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], | |||||
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], | |||||
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true], | |||||
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], | |||||
Lc\AdminBundle\LcAdminBundle::class => ['all' => true], | |||||
Artgris\Bundle\FileManagerBundle\ArtgrisFileManagerBundle::class => ['all' => true], | |||||
EasyCorp\Bundle\EasyAdminBundle\EasyAdminBundle::class => ['all' => true], | |||||
FOS\CKEditorBundle\FOSCKEditorBundle::class => ['all' => true], | |||||
Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true], | |||||
]; | ]; |
artgris_file_manager: | |||||
conf: | |||||
default: | |||||
dir: "../public/uploads" | |||||
type: 'image' |
alias: App | alias: App | ||||
resolve_target_entities: | resolve_target_entities: | ||||
Lc\AdminBundle\IModel\User\UserInterface: App\Entity\User | Lc\AdminBundle\IModel\User\UserInterface: App\Entity\User | ||||
Lc\AdminBundle\IModel\Cms\FileInterface: App\Entity\File |
# Read the documentation: https://symfony.com/doc/current/bundles/FOSCKEditorBundle/index.html | # Read the documentation: https://symfony.com/doc/current/bundles/FOSCKEditorBundle/index.html | ||||
fos_ck_editor: | |||||
input_sync: true | |||||
default_config: base_config | |||||
configs: | |||||
base_config: | |||||
filebrowserBrowseRoute: file_manager | |||||
filebrowserBrowseRouteParameters: | |||||
conf: default | |||||
module: ckeditor | |||||
format_tags: 'p;h2;h3' | |||||
toolbar: | |||||
- { name: "styles", items: ['Bold', 'Italic','Underline', 'Strike']} | |||||
- { name: "paragraph", items: ['Format', 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote'] } | |||||
- { name: "link", items: [ 'Link', 'Unlink'] } | |||||
- {name: 'insert', items: [ 'Image' ]} | |||||
- {name: 'document', items: [ 'Source' ]} | |||||
simple_config: | |||||
toolbar: | |||||
- { items: ['Bold', 'Italic', 'Underline', 'Colors', 'Source'] } | |||||
twig: | twig: | ||||
form_themes: | form_themes: | ||||
- '@FOSCKEditor/Form/ckeditor_widget.html.twig' | - '@FOSCKEditor/Form/ckeditor_widget.html.twig' |
handler_id: null | handler_id: null | ||||
cookie_secure: auto | cookie_secure: auto | ||||
cookie_samesite: lax | cookie_samesite: lax | ||||
translator: { fallbacks: '%app.locales%' } | |||||
#esi: true | #esi: true | ||||
#fragments: true | #fragments: true | ||||
php_errors: | php_errors: |
lc_admin: | |||||
#dashboardDefault: niche |
# Easy way to control access for large sections of your site | # Easy way to control access for large sections of your site | ||||
# Note: Only the *first* access control that matches will be used | # Note: Only the *first* access control that matches will be used | ||||
access_control: | access_control: | ||||
- { path: ^/manager, roles: [ROLE_ADMIN, ROLE_SUPER_ADMIN] } | |||||
- { path: ^/admin, roles: [ROLE_ADMIN, ROLE_SUPER_ADMIN] } | - { path: ^/admin, roles: [ROLE_ADMIN, ROLE_SUPER_ADMIN] } | ||||
- { path: ^/profile, roles: ROLE_USER } | - { path: ^/profile, roles: ROLE_USER } |
# Read the documentation: https://symfony.com/doc/current/bundles/StofDoctrineExtensionsBundle/index.html | # Read the documentation: https://symfony.com/doc/current/bundles/StofDoctrineExtensionsBundle/index.html | ||||
# See the official DoctrineExtensions documentation for more details: https://github.com/Atlantic18/DoctrineExtensions/tree/master/doc/ | # See the official DoctrineExtensions documentation for more details: https://github.com/Atlantic18/DoctrineExtensions/tree/master/doc/ | ||||
stof_doctrine_extensions: | stof_doctrine_extensions: | ||||
default_locale: fr_FR | |||||
default_locale: '%app.default_locale%' | |||||
translation_fallback: true | |||||
orm: | orm: | ||||
default: | default: | ||||
tree: true | tree: true | ||||
timestampable: true # not needed: listeners are not enabled by default | timestampable: true # not needed: listeners are not enabled by default | ||||
sluggable: true | sluggable: true | ||||
blameable: true | blameable: true | ||||
translatable: true | |||||
framework: | framework: | ||||
default_locale: en | |||||
default_locale: '%app.default_locale%' | |||||
translator: | translator: | ||||
default_path: '%kernel.project_dir%/translations' | default_path: '%kernel.project_dir%/translations' | ||||
fallbacks: | |||||
- en | |||||
fallbacks: '%app.locales%' |
twig: | twig: | ||||
default_path: '%kernel.project_dir%/templates' | default_path: '%kernel.project_dir%/templates' | ||||
globals: | |||||
app_locales: "%app.locales%" |
controller: Lc\AdminBundle\Controller\Admin\SecurityController::login | controller: Lc\AdminBundle\Controller\Admin\SecurityController::login | ||||
logout: | logout: | ||||
path: /logout | path: /logout | ||||
controller: Lc\AdminBundle\Admin\SecurityController::logout | |||||
controller: Lc\AdminBundle\Admin\SecurityController::logout | |||||
artgris_bundle_file_manager: | |||||
resource: "@ArtgrisFileManagerBundle/Controller" | |||||
type: annotation | |||||
prefix: /manager |
# Put parameters here that don't need to change on each machine where the app is deployed | # Put parameters here that don't need to change on each machine where the app is deployed | ||||
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration | # https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration | ||||
parameters: | parameters: | ||||
app.locales: ["fr", "en"] | |||||
app.default_locale: "fr" | |||||
services: | services: | ||||
# default configuration for services in *this* file | # default configuration for services in *this* file | ||||
_defaults: | _defaults: |
<?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 Version20210321140455 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 page (id INT AUTO_INCREMENT NOT NULL, created_by_id INT NOT NULL, updated_by_id INT NOT NULL, title VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, meta_title VARCHAR(255) DEFAULT NULL, meta_description LONGTEXT DEFAULT NULL, old_urls LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\', slug VARCHAR(255) NOT NULL, position DOUBLE PRECISION NOT NULL, status DOUBLE PRECISION NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, dev_alias VARCHAR(255) DEFAULT NULL, image VARCHAR(255) DEFAULT NULL, INDEX IDX_140AB620B03A8386 (created_by_id), INDEX IDX_140AB620896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, email VARCHAR(180) NOT NULL, roles LONGTEXT NOT NULL COMMENT \'(DC2Type:json)\', password VARCHAR(255) NOT NULL, lastname VARCHAR(255) DEFAULT NULL, firstname VARCHAR(255) DEFAULT NULL, is_verified TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_8D93D649E7927C74 (email), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('ALTER TABLE page ADD CONSTRAINT FK_140AB620B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)'); | |||||
$this->addSql('ALTER TABLE page ADD CONSTRAINT FK_140AB620896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)'); | |||||
} | |||||
public function down(Schema $schema) : void | |||||
{ | |||||
// this down() migration is auto-generated, please modify it to your needs | |||||
$this->addSql('ALTER TABLE page DROP FOREIGN KEY FK_140AB620B03A8386'); | |||||
$this->addSql('ALTER TABLE page DROP FOREIGN KEY FK_140AB620896DBBDE'); | |||||
$this->addSql('DROP TABLE page'); | |||||
$this->addSql('DROP TABLE user'); | |||||
} | |||||
} |
<?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 Version20210428070931 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 file (id INT AUTO_INCREMENT NOT NULL, created_by_id INT NOT NULL, updated_by_id INT NOT NULL, image VARCHAR(255) DEFAULT NULL, legend VARCHAR(255) DEFAULT NULL, dev_alias VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, locales_enabled LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\', position DOUBLE PRECISION NOT NULL, INDEX IDX_8C9F3610B03A8386 (created_by_id), INDEX IDX_8C9F3610896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('CREATE TABLE lc_translations_entity (id INT AUTO_INCREMENT NOT NULL, locale VARCHAR(8) NOT NULL, object_class VARCHAR(191) NOT NULL, field VARCHAR(32) NOT NULL, foreign_key VARCHAR(64) NOT NULL, content LONGTEXT DEFAULT NULL, INDEX entity_translation_idx (locale, object_class, field, foreign_key), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('CREATE TABLE page (id INT AUTO_INCREMENT NOT NULL, image_id INT DEFAULT NULL, created_by_id INT NOT NULL, updated_by_id INT NOT NULL, title VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, meta_title VARCHAR(255) DEFAULT NULL, meta_description LONGTEXT DEFAULT NULL, old_urls LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\', slug VARCHAR(255) NOT NULL, position DOUBLE PRECISION NOT NULL, status DOUBLE PRECISION NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, dev_alias VARCHAR(255) DEFAULT NULL, locales_enabled LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\', INDEX IDX_140AB6203DA5256D (image_id), INDEX IDX_140AB620B03A8386 (created_by_id), INDEX IDX_140AB620896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('CREATE TABLE page_file (page_id INT NOT NULL, file_id INT NOT NULL, INDEX IDX_B5B2ACAC4663E4 (page_id), INDEX IDX_B5B2ACA93CB796C (file_id), PRIMARY KEY(page_id, file_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, email VARCHAR(180) NOT NULL, roles LONGTEXT NOT NULL COMMENT \'(DC2Type:json)\', password VARCHAR(255) NOT NULL, lastname VARCHAR(255) DEFAULT NULL, firstname VARCHAR(255) DEFAULT NULL, is_verified TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_8D93D649E7927C74 (email), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
$this->addSql('ALTER TABLE file ADD CONSTRAINT FK_8C9F3610B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)'); | |||||
$this->addSql('ALTER TABLE file ADD CONSTRAINT FK_8C9F3610896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)'); | |||||
$this->addSql('ALTER TABLE page ADD CONSTRAINT FK_140AB6203DA5256D FOREIGN KEY (image_id) REFERENCES file (id)'); | |||||
$this->addSql('ALTER TABLE page ADD CONSTRAINT FK_140AB620B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)'); | |||||
$this->addSql('ALTER TABLE page ADD CONSTRAINT FK_140AB620896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)'); | |||||
$this->addSql('ALTER TABLE page_file ADD CONSTRAINT FK_B5B2ACAC4663E4 FOREIGN KEY (page_id) REFERENCES page (id) ON DELETE CASCADE'); | |||||
$this->addSql('ALTER TABLE page_file ADD CONSTRAINT FK_B5B2ACA93CB796C FOREIGN KEY (file_id) REFERENCES file (id) ON DELETE CASCADE'); | |||||
} | |||||
public function down(Schema $schema) : void | |||||
{ | |||||
// this down() migration is auto-generated, please modify it to your needs | |||||
$this->addSql('ALTER TABLE page DROP FOREIGN KEY FK_140AB6203DA5256D'); | |||||
$this->addSql('ALTER TABLE page_file DROP FOREIGN KEY FK_B5B2ACA93CB796C'); | |||||
$this->addSql('ALTER TABLE page_file DROP FOREIGN KEY FK_B5B2ACAC4663E4'); | |||||
$this->addSql('ALTER TABLE file DROP FOREIGN KEY FK_8C9F3610B03A8386'); | |||||
$this->addSql('ALTER TABLE file DROP FOREIGN KEY FK_8C9F3610896DBBDE'); | |||||
$this->addSql('ALTER TABLE page DROP FOREIGN KEY FK_140AB620B03A8386'); | |||||
$this->addSql('ALTER TABLE page DROP FOREIGN KEY FK_140AB620896DBBDE'); | |||||
$this->addSql('DROP TABLE file'); | |||||
$this->addSql('DROP TABLE lc_translations_entity'); | |||||
$this->addSql('DROP TABLE page'); | |||||
$this->addSql('DROP TABLE page_file'); | |||||
$this->addSql('DROP TABLE user'); | |||||
} | |||||
} |
class DashboardController extends LcDashboardController | class DashboardController extends LcDashboardController | ||||
{ | { | ||||
} | } |
use App\Entity\Page; | use App\Entity\Page; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField; | use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\ImageField; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField; | use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | ||||
use Lc\AdminBundle\Controller\Admin\AbstractCrudController; | use Lc\AdminBundle\Controller\Admin\AbstractCrudController; | ||||
use Lc\AdminBundle\Field\CKEditorField; | |||||
use Lc\AdminBundle\Field\FileManagerField; | |||||
use Lc\AdminBundle\Field\GalleryManagerField; | |||||
class PageCrudController extends AbstractCrudController | class PageCrudController extends AbstractCrudController | ||||
{ | { | ||||
public function configureFields(string $pageName): iterable | public function configureFields(string $pageName): iterable | ||||
{ | { | ||||
return [ | |||||
TextField::new('title'), | |||||
TextEditorField::new('description'), | |||||
ImageField::new('image') | |||||
->setBasePath('/uploads/') | |||||
->setUploadDir('public/uploads/'), | |||||
TextField::new('devAlias'), | |||||
ChoiceField::new('status') | |||||
->setChoices(['En ligne'=> 1, 'Hors ligne'=>0]) | |||||
->setFormTypeOption('expanded', true) | |||||
->setFormTypeOption('multiple', false) | |||||
->setCustomOption('widget', false) | |||||
]; | |||||
return [ | |||||
TextField::new('title'), | |||||
CKEditorField::new('description'), | |||||
FileManagerField::new('image'), | |||||
GalleryManagerField::new('gallery'), | |||||
TextField::new('devAlias'), | |||||
ChoiceField::new('status') | |||||
->setChoices(['En ligne' => 1, 'Hors ligne' => 0]) | |||||
->setFormTypeOption('expanded', true) | |||||
->setFormTypeOption('multiple', false) | |||||
->setCustomOption('widget', false) | |||||
]; | |||||
} | } | ||||
} | } |
<?php | |||||
namespace App\Entity; | |||||
use Doctrine\ORM\Mapping as ORM; | |||||
use Lc\AdminBundle\IModel\Cms\FileInterface; | |||||
use Lc\AdminBundle\Repository\Cms\FileRepository; | |||||
use Lc\AdminBundle\Model\Cms\File as LcFileModel; | |||||
use Gedmo\Mapping\Annotation as Gedmo; | |||||
use Lc\AdminBundle\Entity\Translation\EntityTranslation; | |||||
/** | |||||
* @ORM\Entity(repositoryClass=FileRepository::class) | |||||
* @Gedmo\TranslationEntity(class=EntityTranslation::class) | |||||
*/ | |||||
class File extends LcFileModel implements FileInterface | |||||
{ | |||||
/** | |||||
* @ORM\Id | |||||
* @ORM\GeneratedValue | |||||
* @ORM\Column(type="integer") | |||||
*/ | |||||
private $id; | |||||
public function getId(): ?int | |||||
{ | |||||
return $this->id; | |||||
} | |||||
} |
namespace App\Entity; | namespace App\Entity; | ||||
use App\Repository\PageRepository; | use App\Repository\PageRepository; | ||||
use Doctrine\Common\Collections\ArrayCollection; | |||||
use Doctrine\Common\Collections\Collection; | |||||
use Doctrine\ORM\Mapping as ORM; | use Doctrine\ORM\Mapping as ORM; | ||||
use Lc\AdminBundle\IModel\Cms\ImageInterface; | |||||
use Gedmo\Mapping\Annotation as Gedmo; | |||||
use Lc\AdminBundle\Entity\Translation\EntityTranslation; | |||||
use Lc\AdminBundle\IModel\Translation\TranslatableInterface; | |||||
use Lc\AdminBundle\Model\Cms\AbstractDocument; | use Lc\AdminBundle\Model\Cms\AbstractDocument; | ||||
use Lc\AdminBundle\Model\Cms\ImageTrait; | |||||
use Lc\AdminBundle\Model\Translation\TranslatableTrait; | |||||
/** | /** | ||||
* @ORM\Entity(repositoryClass=PageRepository::class) | * @ORM\Entity(repositoryClass=PageRepository::class) | ||||
* @Gedmo\TranslationEntity(class=EntityTranslation::class) | |||||
*/ | */ | ||||
class Page extends AbstractDocument implements ImageInterface | |||||
class Page extends AbstractDocument implements TranslatableInterface | |||||
{ | { | ||||
use ImageTrait; | |||||
use TranslatableTrait; | |||||
/** | /** | ||||
* @ORM\Id | * @ORM\Id | ||||
*/ | */ | ||||
private $id; | private $id; | ||||
/** | |||||
* @ORM\ManyToOne(targetEntity=File::class, cascade={"persist", "remove"}) | |||||
*/ | |||||
private $image; | |||||
/** | |||||
* @ORM\ManyToMany(targetEntity=File::class, cascade={"persist", "remove"}, orphanRemoval=true) | |||||
* @ORM\OrderBy({"position" = "ASC"}) | |||||
*/ | |||||
private $gallery; | |||||
public function __construct() | |||||
{ | |||||
$this->gallery = new ArrayCollection(); | |||||
} | |||||
public function getId(): ?int | public function getId(): ?int | ||||
{ | { | ||||
return $this->id; | return $this->id; | ||||
} | } | ||||
public function getImage(): ?File | |||||
{ | |||||
return $this->image; | |||||
} | |||||
public function setImage(?File $image): self | |||||
{ | |||||
$this->image = $image; | |||||
return $this; | |||||
} | |||||
/** | |||||
* @return Collection|File[] | |||||
*/ | |||||
public function getGallery(): Collection | |||||
{ | |||||
return $this->gallery; | |||||
} | |||||
public function addGallery(File $gallery): self | |||||
{ | |||||
if (!$this->gallery->contains($gallery)) { | |||||
$this->gallery[] = $gallery; | |||||
} | |||||
return $this; | |||||
} | |||||
public function removeGallery(File $gallery): self | |||||
{ | |||||
$this->gallery->removeElement($gallery); | |||||
return $this; | |||||
} | |||||
} | } |
{ | { | ||||
"artgris/filemanager-bundle": { | |||||
"version": "2.2.3" | |||||
}, | |||||
"behat/transliterator": { | "behat/transliterator": { | ||||
"version": "v1.3.0" | "version": "v1.3.0" | ||||
}, | }, | ||||
"composer/installers": { | |||||
"version": "v1.10.0" | |||||
}, | |||||
"composer/package-versions-deprecated": { | "composer/package-versions-deprecated": { | ||||
"version": "1.11.99.1" | "version": "1.11.99.1" | ||||
}, | }, | ||||
] | ] | ||||
}, | }, | ||||
"gedmo/doctrine-extensions": { | "gedmo/doctrine-extensions": { | ||||
"version": "v3.0.0" | |||||
"version": "v3.0.4" | |||||
}, | }, | ||||
"laminas/laminas-code": { | "laminas/laminas-code": { | ||||
"version": "3.5.1" | "version": "3.5.1" | ||||
"nikic/php-parser": { | "nikic/php-parser": { | ||||
"version": "v4.10.4" | "version": "v4.10.4" | ||||
}, | }, | ||||
"oomphinc/composer-installers-extender": { | |||||
"version": "2.0.0" | |||||
}, | |||||
"php": { | "php": { | ||||
"version": "7.4" | "version": "7.4" | ||||
}, | }, | ||||
"version": "v1.20.0" | "version": "v1.20.0" | ||||
}, | }, | ||||
"symfony/polyfill-uuid": { | "symfony/polyfill-uuid": { | ||||
"version": "v1.20.0" | |||||
"version": "v1.22.1" | |||||
}, | }, | ||||
"symfony/process": { | "symfony/process": { | ||||
"version": "v5.2.1" | "version": "v5.2.1" | ||||
"version": "v1.0.1" | "version": "v1.0.1" | ||||
}, | }, | ||||
"symfony/uid": { | "symfony/uid": { | ||||
"version": "v5.2.1" | |||||
"version": "v5.2.6" | |||||
}, | }, | ||||
"symfony/validator": { | "symfony/validator": { | ||||
"version": "4.3", | "version": "4.3", |