Download the PHP package headsnet/doctrine-tools-bundle without Composer
On this page you can find all versions of the php package headsnet/doctrine-tools-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package doctrine-tools-bundle
Doctrine Tools for Symfony
Various tools and helpers for using Doctrine ORM in larger Symfony projects.
Installation
If your Symfony installation does not auto-register bundles, add it manually:
Features
- Dynamically Create Types For Standard Objects
- Auto-Register Custom Doctrine Type Mappings
- Auto-Register Carbon Doctrine Type Mappings
Dynamically Create Types For Standard Objects
Applying the #[DoctrineType]
attribute to a class will generate a Doctrine mapping type for the object and register
it in the application. To configure this behaviour, you must specify where to look for the classes to auto-register.
Currently the bundle supports the following standard types:
string
viaAbstractStringMappingType
integer
viaAbstractIntegerMappingType
uuid
viaAbstractUuidMappingType
For example, we have a string backed value object:
This will cause a PHP file to be generated that provides the Doctrine Mapping Type for the class - something like:
This file is created in src/_generated/
- you will want to add this directory to your .gitignore
file.
Auto-Register Custom Doctrine Type Mappings
The bundle can auto-register custom Doctrine DBAL types, eliminating the need to specify them all in
config/packages/doctrine.yaml
:
Define the directories to scan for Doctrine types:
Then add the #[DoctrineTypeMapping]
attribute to the custom type class:
This will register a custom type based on the class name - in this case the custom column type will be called
reservation_id
.
To customise the type name, specify it in the #[DoctrineTypeMapping]
attribute. The following will register a type
called my_reservation_id
.
Auto-Register Carbon datetime type mappings
If the nesbot/carbon
package is installed, this package will automatically register the Doctrine types provided by
Carbon.
By default, it will overwrite the default Doctrine types for datetime
and datetime_immutable
with the Carbon
equivalents:
If you wish the Carbon types to operate alongside the default DateTime and DateTimeImmutable types, set replace: false
in the bundle configuration. This will result in additional types being defined for the Carbon columns.
If you wish to completely disable this behaviour, set enabled: false
in the bundle configuration.
Contributions
Contributions are welcome via Pull Requests. Please include a single change in each PR.
License
Released under the MIT License.
All versions of doctrine-tools-bundle with dependencies
doctrine/dbal Version ^3.0 || ^4.0
league/construct-finder Version dev-main
symfony/config Version ^6.0 || ^7.0
symfony/dependency-injection Version ^6.0 || ^7.0
symfony/http-kernel Version ^6.0 || ^7.0
doctrine/doctrine-bundle Version ^2.0
symfony/uid Version ^7.0