enjoyscms / articles
2.0.0
2023-02-18 11:54 UTC
Requires
- php: ^8.0
- beberlei/doctrineextensions: ^1.3
- enjoyscms/admin: ^4.3
- enjoyscms/core: ^4.7
- enjoyscms/elfinder: ^4.1
- gedmo/doctrine-extensions: ^3.9
README
- 在
/config/doctrine.php
中添加 doctrine 配置
use Doctrine\Common\Annotations\AnnotationReader; use Doctrine\Common\EventManager; use Gedmo\Timestampable\TimestampableListener; use Gedmo\Tree\TreeListener; $evm = new EventManager(); $annotationReader = new AnnotationReader(); $timestampListener = new TimestampableListener(); $timestampListener->setAnnotationReader($annotationReader); $evm->addEventSubscriber($timestampListener); $treeListener = new TreeListener(); $treeListener->setAnnotationReader($annotationReader); $evm->addEventSubscriber($treeListener);
- 在
$loader = require_once __DIR__ . "/vendor/autoload.php";
之后,在/bootstrap.php
中加载注解类
use Doctrine\Common\Annotations\AnnotationRegistry; use Gedmo\Mapping\Annotation\Timestampable; use Gedmo\Mapping\Annotation\Tree; use Gedmo\Mapping\Annotation\TreeClosure; use Gedmo\Mapping\Annotation\TreeLevel; use Gedmo\Mapping\Annotation\TreeParent; AnnotationRegistry::loadAnnotationClass(TreeLevel::class); AnnotationRegistry::loadAnnotationClass(Tree::class); AnnotationRegistry::loadAnnotationClass(TreeClosure::class); AnnotationRegistry::loadAnnotationClass(TreeParent::class); AnnotationRegistry::loadAnnotationClass(Timestampable::class);
- 差异迁移、迁移和清除缓存元数据
composer diff
composer migrate
或
./vendor/bin/doctrine-migrations diff --allow-empty-diff --formatted
./vendor/bin/doctrine-migrations migrate --no-interaction
./vendor/bin/doctrine orm:clear-cache:metadata
- 设置 elfinder