bigdropinc/yii2-find-by-attribute

Allowed to use magic methods for finding active records by attributes

v0.2 2017-05-16 14:18 UTC

This package is not auto-updated.

Last update: 2024-04-13 23:36:16 UTC


README

Allowed to use magic methods for finding active records by attributes

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist bigdropinc/yii2-find-by-attribute "*"

or add

"bigdropinc/yii2-find-by-attribute": "*"

to the require section of your composer.json file.

Usage

Add into your base Active Record method like this

use bigdropinc\db\FindByAttribute

public static function __callStatic($name, $arguments)
    {
        if(static::isFindByCanProcess($name)){
            return static::processFindBy($name, $arguments);
        }
    }