Download the PHP package dotkernel/dot-data-fixtures without Composer
On this page you can find all versions of the php package dotkernel/dot-data-fixtures. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dotkernel/dot-data-fixtures
More information about dotkernel/dot-data-fixtures
Files in dotkernel/dot-data-fixtures
Package dot-data-fixtures
Short Description Provides a CLI interface for listing & executing doctrine data fixtures
License MIT
Homepage https://github.com/dotkernel/dot-data-fixtures
Informations about the package dot-data-fixtures
dot-data-fixtures
dot-data-fixtures provides a CLI interface for interacting with doctrine/data-fixtures.
dot-data-fixtures is a wrapper on top of doctrine/data-fixtures
Documentation
Documentation is available at: https://docs.dotkernel.org/dot-data-fixtures/.
Badges
This package provides a CLI interface for interacting with doctrine/data-fixtures.
Executing fixtures will append data to the tables.
Requirements
- PHP: 8.2, 8.3 or 8.4
- doctrine/orm: => 3.0
- doctrine/data-fixtures: => 2.0
Installation
Run the following command in your project directory
Next, register the package's ConfigProvider into your application config.
In doctrine.global.php (or your custom doctrine config file) add a new key fixtures, in the doctrine array, the value should be a valid path to a folder where your fixtures can be found.
Make sure the path is valid before proceeding to the next step.
Example
The last step is to register the commands.
We can register the commands to work with the default CLI that doctrine provides us.
Create a new php file bin/doctrine (if you don't already have this file feel free to copy it from the below example)
Usage
List fixtures command: will list all the available fixtures, by order of execution.
`
Execute fixtures command: this command will execute one or all fixtures.
To execute all the fixtures, run:
To execute a specific fixture, run:
Creating fixtures
When creating a new fixture, we have two requirements:
- Fixtures should be created in the folder we configured earlier:
data/doctrine/fixtures - Fixtures should implement
FixtureInterfaceand have aloadmethod. - Create a new PHP file and copy the below code-block.
Example
Ordering fixtures
Fixtures can be ordered:
- by order
- by dependencies
Please refer to this link for further details on ordering fixtures:
All versions of dot-data-fixtures with dependencies
doctrine/data-fixtures Version ^2.0
doctrine/orm Version ^3.0
symfony/console Version ^7.0