propel-behavior propel-real-enum-behavior
Propel 2 behavior to manage the ENUM type more closely to what enums should be
effenti/propel-real-enum-behavior
Propel 2 behavior to manage the ENUM type more closely to what enums should be
- Friday, June 15, 2018
- by Titoeuf
- Repository
- 3 Watchers
- 0 Stars
- 14 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 3 Versions
- 100 % Grown
Propel Real Enum Behavior
, (*1)
Requirements
This Behavior was developed for Propel 2.
It was also only tested for MySQL databases, if you wish to test it or adjust it for another database type, feel free to open an issue., (*2)
Installation
composer require effenti/propel-real-enum-behavior
schema.xml
Add the behavior either to the root of your database or on the target table.
Here is an example :, (*3)
<database ...>
<!-- This will add the real-enum behavior for all enums in the database -->
<behavior name="real-enum"/>
<table name="my_table">
<column name="my_enum" type="ENUM" valueSet="FIRST,SECOND,THIRD" />
</table>
</database>
Usage
This behavior does 2 things to make usage of ENUMS
easier :, (*4)
- You will now see the ENUM value from the
valueSet
in the database instead of a number.
- Model classes will now have constants to easily access the enum values. Using the example above we could get a value from the value set like this :
MyTable::MY_ENUM_SECOND
dev-master
9999999-dev
Propel 2 behavior to manage the ENUM type more closely to what enums should be
Sources
Download
MIT
The Requires
by
Maxime BĂ©langer
1.0.3
1.0.3.0
Propel 2 behavior to manage the ENUM type more closely to what enums should be
Sources
Download
MIT
The Requires
by
Maxime BĂ©langer
1.0.2
1.0.2.0
Propel 2 behavior to manage the ENUM type more closely to what enums should be
Sources
Download
MIT
The Requires
by
Maxime BĂ©langer