orkestra / common
Provides common functionality useful for Doctrine 2 based projects
Installs: 1 384
Dependents: 6
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 1
Open Issues: 3
Requires
- php: >=5.3.3
- doctrine/orm: ~2.3
Suggests
- ext-mcrypt: For support of encrypted string fields on entities
This package is not auto-updated.
Last update: 2024-12-21 13:00:58 UTC
README
Provides useful functionality for any Doctrine 2 based project including:
- Transparent user/server timezone conversion
- Encrypted string fields
- Enumerations
Installation
The easiest way to add orkestra-common to your project is using composer.
Add orkestra-common to your composer.json
file:
{ "require": { "orkestra/common": "dev-master" } }
Then run composer install
or composer update
.
Configuration
Each feature provided by common requires a bit of set up.
Dates and Times
Orkestra's custom DateTime implementation allows for easier conversion between server and user time, without the need for a full-blown localization or internationalization implementation.
# /path/to/your/bootstrap.php <?php use Doctrine\DBAL\Types\Type; // DateTime types Type::overrideType('datetime', 'Orkestra\Common\DbalType\DateTimeType'); Type::overrideType('date', 'Orkestra\Common\DbalType\DateType');
Encrypted string fields
The encrypted_string
field type transparently encrypts and decrypts data when persisting and hydrating entities.
Enumerations
Enumerations are not supported by PHP nor Doctrine 2 out of the box. Common provides a base class for your own custom enumeration implementations. Each enumeration requires the enumeration itself and a corresponding DbalType class to integrate the enumeration with Doctrine 2.