atournayre / fixtures-bundle
此包最新版本(0.2.0)没有提供许可证信息。
配置文件包
0.2.0
2024-03-03 10:32 UTC
Requires
- php: >=8.1
- hautelook/alice-bundle: ^2.12
- symfony/config: ^6.2 || ^7.0
- symfony/dependency-injection: ^6.2 || ^7.0
- symfony/http-kernel: ^6.2 || ^7.0
- symfony/password-hasher: ^6.2 || ^7.0
- symfony/uid: ^6.2 || ^7.0
Requires (Dev)
- phpunit/phpunit: ^10.0
This package is auto-updated.
Last update: 2024-09-03 11:29:51 UTC
README
此包帮助使用Alice创建配置文件。
要求
Symfony 6.2.*
PHP >=8.2
安装
使用 Composer 安装此包
Composer
composer require atournayre/fixtures-bundle --dev
注册包
// config/bundles.php return [ // ... Hautelook\AliceBundle\HautelookAliceBundle::class => ['dev' => true, 'test' => true], Atournayre\Bundle\FixtureBundle\AtournayreFixtureBundle::class => ['dev' => true, 'test' => true], // ... ]
特性
加载配置文件的命令
php bin/console fixtures
事件
- BeforeFixturesEvent
- AfterFixturesEvent
提供者
- DateTime
- 实体
- Uuid
- 哈希密码
示例
配置文件
App\Entity\User: admin: # id: '<uuidV1()>' id: '<uuidV4()>' # id: '<uuidV6()>' # id: '<uuidV7()>' # id: '<uuidV8(uuid)>' email: 'admin@example.com' password: '<hashPassword(super_password)>' # The current date with specific time dateTime: '<currentDateWithTime(09:10)>' # The current date with random hour otherDateTime: '<randomHourWithDate()>' # A related entity identified by its id relatedEntity: '<entity<1, App\Entity\RelatedEntity)>' # A related entity identified by its uuid otherRelatedEntity: '<entity<b8ecc665-0d81-4a09-8ede-2c23a4355836, App\Entity\RelatedEntity)>'
事件
<?php namespace App\Listener; use Symfony\Component\EventDispatcher\Attribute\AsEventListener; use Atournayre\Bundle\FixtureBundle\Event\AfterFixturesEvent; #[AsEventListener] readonly class AfterFixtureListener { public function __invoke(AfterFixturesEvent $event): void { // Your code } }
贡献
欢迎对包的贡献!
许可证
本包所有内容均受 MIT许可证 授权。