kossmoss / yii2-postgresql-array-field
Yii2 postgresql array field support behavior
Installs: 29 414
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 2
Forks: 4
Open Issues: 1
Requires
- php: >=5.4.0
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2025-01-02 00:05:07 UTC
README
Yii2 postgresql array field support behavior
================
Provides PostgreSQL array fields support for yii2 models.
Installation
Add a dependency to your project's composer.json:
{ "require": { "kossmoss/yii2-postgresql-array-field": "^0.2" } }
Usage example
Attach behavior to one or more fields of your model
use yii\db\ActiveRecord; use \kossmoss\PostgresqlArrayField\PostgresqlArrayFieldBehavior; /** * @property array $modelField */ class Model extends ActiveRecord{ public function behaviors() { return [ [ 'class' => PostgresqlArrayFieldBehavior::className(), 'arrayFieldName' => 'modelField', // model's field to attach behavior 'onEmptySaveNull' => true // if set to false, empty array will be saved as empty PostreSQL array '{}' (default: true) ] ]; } }