Download the PHP package havvg/propel-autoexpire-behavior without Composer
On this page you can find all versions of the php package havvg/propel-autoexpire-behavior. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download havvg/propel-autoexpire-behavior
More information about havvg/propel-autoexpire-behavior
Files in havvg/propel-autoexpire-behavior
Package propel-autoexpire-behavior
Short Description The AutoExpireBehavior adds automatic expiration to your model.
License MIT
Informations about the package propel-autoexpire-behavior
AutoExpireBehavior
See the Propel documentation on how to install a third party behavior
Usage
Just add the following XML tag in your schema.xml
file:
The behavior will add a column storing the expiration date and those methods: preExpire
, expire
, doExpire
, postExpire
and isExpired
.
Configuration
The following options are provided to customize the behavior.
The column
option defines the name of the column to store the expiration date into.
If the column is not given, it will be added. Defaults to expires_at
.
The required
flag indicates whether the expiration date is required.
If true
the column will be NOT NULL
.
An auto_delete
option can be set to automatically delete the expired model.
When set, this option will apply the "Expiration" behavior to the postHydrate
hook of the model.
Expiration
Whenever a model expires by calling expire
, the following behavior is applied - similar to save
or delete
.
- The
preExpire
method is called. The process will be aborted, if this methods returnsfalse
. - The
doExpire
method will be called. - The
postExpire
method is called afterwards.
In addition, the isExpired
method will be added to check whether the model is expired.