2017 © Pedro PelĂĄez
 

library yii-owner-behavior

Behavior to automate setting the "owned by user" attribute to the currently logged in user id upon creation of a record.

image

motin/yii-owner-behavior

Behavior to automate setting the "owned by user" attribute to the currently logged in user id upon creation of a record.

  • Thursday, November 21, 2013
  • by motin
  • Repository
  • 1 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Behavior to automate setting the "owned by user" attribute to the currently logged in user id upon creation of a record., (*1)

Setup

Download and install

Ensure that you have the following in your composer.json:, (*2)

"repositories":[
    {
        "type": "vcs",
        "url": "https://github.com/motin/yii-owner-behavior"
    },
    ...
],
"require":{
    "motin/owner-behavior":"@dev",
    ...
},

Then install through composer:, (*3)

php composer.php update motin/yii-owner-behavior

If you don't use composer, clone or download this project into /path/to/your/app/vendor/motin/owner-behavior, (*4)

Import the behavior in main.php

'import' => array(
    ...
    'vendor.motin.yii-owner-behavior.OwnerBehavior',
    ...
),

Configure models to be part of the qa process

public function behaviors()
{
    return array(
        'owner-behavior' => array(
             'class' => 'OwnerBehavior',
        ),
    );
}

Changelog

0.1.0

  • Only setting the attribute if it is null, so that one can specify the field manually before hitting insert()/save()

0.0.0

  • Forked/revived thyseus thyseus@gmail.com OwnerBehavior from https://github.com/schmunk42/p3extensions/commit/aa990c986fabd4ab5932ee504b593b230238ccac

The Versions

21/11 2013

dev-master

9999999-dev

Behavior to automate setting the "owned by user" attribute to the currently logged in user id upon creation of a record.

  Sources   Download

The Requires

  • php >=5.2.0

 

by Avatar thyseus