Spaintheofidry/AliceDataFixtures
Nelmio Alice extension to persist the loaded fixtures.
🔌 AliceDataFixtures: Lớp lưu trữ cho Nelmio Alice 3.x
Bổ sung lớp persistence cho Nelmio Alice 3.x, tự động tải và lưu trữ fixture vào CSDL qua Symfony hoặc standalone.
AliceDataFixtures là một thư viện PHP mở rộng từ Nelmio Alice 3.x — phiên bản này không còn tích hợp sẵn lớp lưu trữ (persistence layer). Thư viện này điền đất hụt đó, cho phép tải các fixture định nghĩa bằng YAML và lưu trữ chúng trực tiếp vào cơ sở dữ liệu thông qua nhiều driver khác nhau. Dự án hỗ trợ Symfony 7.4+, Doctrine ORM 3.3+, Doctrine ODM 5.1+, Doctrine PHPCR 2.0+ và Eloquent 12.0+.
✨ Điểm nổi bật
- Hỗ trợ đa driver: Tương thích với Doctrine ORM, MongoDB ODM, PHPCR và Eloquent ORM.
- Tự động kích hoạt dịch vụ: Nếu bundle tương ứng được phát hiện (ví dụ DoctrineORMBundle), dịch vụ driver sẽ được bật tự động.
- Cấu hình linh hoạt: Cho phép thiết lập
default_purge_mode(delete/truncate/no_purge) và bật/tắt từng driver. - Dễ tích hợp Symfony: Hỗ trợ cài đặt với Flex hoặc thủ công, qua container service.
- Tải fixture từ YAML: Định nghĩa fixture bằng YAML và tải chúng bằng
LoaderInterface. - Hỗ trợ xóa dữ liệu cũ: Tự động purge bảng trước khi insert để tránh trùng lặp.
- Dùng trong test: Dễ dàng tích hợp với PHPUnit hoặc Behat để khởi tạo dữ liệu mẫu.
💡 Vì sao đáng chú ý
Khác với các phiên bản trước của Nelmio Alice, AliceDataFixtures tách rời hoàn toàn lớp lưu trữ ra khỏi core — giúp dự án nhẹ hơn và linh hoạt hơn khi kết hợp với nhiều loại ORM/ODM khác nhau. Đây là lựa chọn lý tưởng cho các dự án Symfony cần quản lý fixture phức tạp mà không muốn viết thủ công logic xóa/lưu dữ liệu.
#PHP #Symfony #Doctrine #Fixtures #Alice #TiniX
Similar Projects
Discover other similar projects and AI models.
Modern, Crazy Fast, Ridiculously Easy and Amazingly Powerful Flat-File CMS powered by PHP, Markdown, Twig, and Symfony
🕸️ Create REST and GraphQL APIs, scaffold Jamstack webapps, stream changes in real-time.
Headless open-source eCommerce platform on top of PHP/Symfony/API Platform
EasyAdmin is a fast, beautiful and modern admin generator for Symfony applications.
Symfony integration for the doctrine/migrations library
An extension to Symfony FrameworkBundle that adds annotation configuration for Controller classes