Download the PHP package teamneusta/pimcore-fixture-bundle without Composer

On this page you can find all versions of the php package teamneusta/pimcore-fixture-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package pimcore-fixture-bundle

Pimcore Fixture Bundle

Provides a way to manage and execute the loading of data fixtures in Pimcore.

It can be useful for testing purposes or for seeding a database with initial data.

Installation

  1. Require the bundle

  2. Enable the bundle

    Add the Bundle to your config/bundles.php:

  3. Register your Fixtures Folder for Service autoconfiguration

    Depending on where you want to create your Fixtures, or if they should only be accessible during test execution.

Usage

Writing Fixtures

Data fixtures are PHP service classes where you create objects and persist them to the database.

Imagine that you want to add some Product objects to your database. To do this, create a fixture class and start adding products:

Referencing Fixtures and Depending on Other Fixtures

Suppose you want to link a Product fixture to a Group fixture. To do this, you need to create a Group fixture first and keep a reference to it. Later you can use this reference when creating the Product fixture.

This process requires the Group fixture to exist before the Product fixture. You can achieve this ordering by implementing the HasDependencies interface.

Loading Fixtures

In Tests

To load fixtures in Tests, we offer the SelectiveFixtureLoader. To streamline your test setup, we recommend creating a base class with a method to load fixtures via the SelectiveFixtureLoader. Here’s an example demonstrating how to implement this.

Use the base class as follows:

As Initial Data in Your Project

To load fixtures in your local environment or as part of a deployment, two commands are provided:

Beware that loading a large number of objects may lead to high memory consumption. Should you encounter memory issues when running the commands in dev environments you may want to try setting the environment to prod. Disabling the debug mode also seems beneficial in terms of memory consumption.

For example, provide these options when using the symfony console:

Accessing Services From the Fixtures

As the Fixtures are just normal PHP services, you can use all DI features like constructor, setter, or property injection as usual.

Extension and Customization Through Events

The Bundle provides the following events to facilitate extensions and customization:

  1. BeforeLoadFixtures
    This event is dispatched before any fixture is executed. It contains all the fixtures that are scheduled for execution, accessible via $event->fixtures. You can alter the list of fixtures to be loaded by modifying it $event->fixtures = ....

  2. BeforeExecuteFixture
    This event is dispatched for each fixture just before it is executed. Using this event, you can prevent the execution of a specific fixture by setting $event->preventExecution = true.

  3. AfterExecuteFixture
    This event is dispatched for each fixture after it has been executed.

  4. AfterLoadFixtures
    This event is dispatched after all relevant fixtures have been executed. It carries the fixtures that have been successfully loaded, which can be accessed through $event->loadedFixtures.

Contribution

Feel free to open issues for any bug, feature request, or other ideas.

Please remember to create an issue before creating large pull requests.

Local Development

To develop on your local machine, instance identification for Pimcore 12 is needed.

Copy the compose.override.yaml.dist file to compose.override.yaml:

And replace all replace_with_secret values with your data.

Then install the dependencies:

We use composer scripts for our main quality tools. They can be executed via the bin/composer file as well.

For the tests there is a different script that includes a database setup.


bin/run-tests

All versions of pimcore-fixture-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0
doctrine/dbal Version ^3.2 || ^4.0
pimcore/pimcore Version ^11.0 || ^12.0
psr/log Version ^2 || ^3
symfony/config Version ^6.4 || ^7.4
symfony/console Version ^6.4 || ^7.4
symfony/dependency-injection Version ^6.4 || ^7.4
symfony/doctrine-bridge Version ^6.4 || ^7.4
symfony/event-dispatcher Version ^6.4 || ^7.4
symfony/framework-bundle Version ^6.4 || ^7.4
symfony/http-foundation Version ^6.4 || ^7.4
symfony/http-kernel Version ^6.4 || ^7.4
symfony/service-contracts Version ^2.0 || ^3.0
symfony/stopwatch Version ^6.4 || ^7.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package teamneusta/pimcore-fixture-bundle contains the following files

Loading the files please wait ...