enjoyscms/articles

安装: 784

依赖: 0

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 0

开放问题: 0

类型:enjoyscms-module

2.0.0 2023-02-18 11:54 UTC

This package is auto-updated.

Last update: 2024-09-04 20:55:25 UTC


README

  1. /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);
  1. $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);
  1. 差异迁移、迁移和清除缓存元数据
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
  1. 设置 elfinder