berduj/propel-enable-disable-behavior

Enable / Disabe rows for Propel2

1.0.0 2016-03-03 09:22 UTC

This package is auto-updated.

Last update: 2024-11-11 03:03:12 UTC


README

The Behavior adds "enabled" column in table, and adds methods to enable/disable each rows.

Installation

Add the package to your composer.json:

{
    "require": {
        "berduj/PropelEnableDisableBehavior"
    }
}

Usage

    <table name="sample_table">
        <column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
        <column name="title" type="VARCHAR" />

        <behavior name="enable-disable"/>
    </table>

Added methods :

Object methods:

$object->enable();
$object->disable();

Query methods:

ObjectQuery::create()->findEnabled();
ObjectQuery::create()->findDisabled();

License

See the LICENSE file.