Download the PHP package carlosv2/dumbsmart-repositories-bundle without Composer
On this page you can find all versions of the php package carlosv2/dumbsmart-repositories-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download carlosv2/dumbsmart-repositories-bundle
More information about carlosv2/dumbsmart-repositories-bundle
Files in carlosv2/dumbsmart-repositories-bundle
Package dumbsmart-repositories-bundle
Short Description Bridge between Symfony and DumbsmartRepositories
License MIT
Informations about the package dumbsmart-repositories-bundle
Dumbsmart Repositories Bundle
This project is a bridge between Dumbsmart Repositories and a symfony project.
Installation
Step 1: Download the Bundle
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Step 2: Enable the bundle
If you are using Allegro then you don't need to do anything else to have it installed.
In case you are not using Allegro, enable the bundle by adding it to the list
of registered bundles in the app/AppKernel.php
file of your project (as it
is meant to be for development, you may want to place it under your development
configuration in this file):
Step 3: Configure it
The following is the available configuration for this bundle:
Where any value is optional being them:
- dumbsmart_repositories.repositories.type: Repositories type. Available values are
file
orin_memory
. Default value:in_memory
. - dumbsmart_repositories.repositories.path: If repository typ is
file
, this is the folder to create them. Default value: systems temp folder. - dumbsmart_repositories.autoconfigure.orm: Configure it from doctrine's entities configuration. Default value:
false
. - dumbsmart_repositories.autoconfigure.odm: Configure it from doctrine's documents configuration. Default value:
false
. - dumbsmart_repositories.entities: Manual entities configuration. Default value: empty array.
- dumbsmart_repositories.aliases: Set of class aliases for repositories reutilisation. Default value: empty array.
Entities
You may use entities for:
- Entities that cannot be autoconfigured
- Injecting repository on a system that does not support Doctrine
You don't need entities for:
- Objects that you won't need to store in a repository
Each entity must have the following fields:
Where:
- id: Points to the ID property in the given class.
- extends: Points to the class that this class is extending from.
- relations: Holds a list of the properties with relations. You only need to set the properties that mapp to other objects
which you also want to have repositories for. Any object mapped as part of any relation must also have an entry in
entities
. Default value: empty array.
Be aware that a class can only have either id
or extends
fields but not both. Also, each property of relations
can
only have one
or many
as assigned values.
Aliases
You may use aliases for:
- Storing together similar classes
- Naming classes after any criteria
You don't need aliases for:
- Inherited classes (if doctrine is set to deal with them, inherited classes will be stored under the same repository).
Depending on the level of configuration you need, you may want to set them using the following shortcut:
Or by using the extended version and aliasing certain fields too (only the ones that change should be defined):
Usage
Once you have completed the configuration, you can request a repository by injecting a service into the dependency injection as follows:
You can create as many repositories as you want but be aware that, depending on the configuration, the same repository might be returned for different classes.
All versions of dumbsmart-repositories-bundle with dependencies
doctrine/common Version ~2.2
symfony/framework-bundle Version ~2.3 || ~3.0
everzet/persisted-objects Version ~1.0
carlosv2/dumbsmart-repositories Version ~1.0