2017 © Pedro Peláez
 

cakephp-plugin cakephp-creatormodifier

CakePHP 3.x Plugin to set Creator and Modifier automagic fields during save.

image

loadsys/cakephp-creatormodifier

CakePHP 3.x Plugin to set Creator and Modifier automagic fields during save.

  • Monday, June 27, 2016
  • by jtyost2
  • Repository
  • 8 Watchers
  • 3 Stars
  • 9,432 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 2 Open issues
  • 5 Versions
  • 7 % Grown

The README.md

CakePHP 3 CreatorModifier plugin

Latest Version Software License Build Status Coverage Status Total Downloads, (*1)

Sets a creator_id and modifier_id on records during save using the logged in User.id field. Operates almost identically to the core's Timestamp behavior., (*2)

Requirements

  • PHP 5.4.16+
  • CakePHP 3.0+

Installation

Composer

$ composer require loadsys/cakephp-creatormodifier:~1.0

In your config/bootstrap.php file, add:, (*3)

Plugin::load('CreatorModifier', ['bootstrap' => false, 'routes' => false]);

OR, (*4)

bin/cake plugin load CreatorModifier

Usage

  • Add this plugin for use in an Table, by adding this line to your Table's initialize() method.
$this->addBehavior('CreatorModifier.CreatorModifier');
  • Or to customize the behavior
$this->addBehavior('CreatorModifier.CreatorModifier', [
    'events' => [
        'Model.beforeSave' => [
            // Field storing the User.id who created the record,
            // only triggers on beforeSave when the Entity is new.
            'user_who_created_me_id' => 'new',

            // Field storing the User.id who modified the record,
            // always triggers on beforeSave.
            'user_who_modified_me_id' => 'always'
        ]
    ],
    // The key to read from `\Cake\Network\Request->session()->read();`
    // to obtain the User.id value to set during saves.
    'sessionUserIdKey' => 'Auth.User.id',
]);

Contributing

Code of Conduct

This project has adopted the Contributor Covenant as its code of conduct. All contributors are expected to adhere to this code. Translations are available., (*5)

Reporting Issues

Please use GitHub Isuses for listing any known defects or issues., (*6)

Development

When developing this plugin, please fork and issue a PR for any new development., (*7)

Set up a working copy:, (*8)

$ git clone git@github.com:YOUR_USERNAME/CakePHP-CreatorModifier.git
$ cd CakePHP-CreatorModifier/
$ composer install
$ vendor/bin/phpcs --config-set installed_paths vendor/loadsys/loadsys_codesniffer,vendor/cakephp/cakephp-codesniffer

Make your changes:, (*9)

$ git checkout -b your-topic-branch
# (Make your changes. Write some tests.)
$ vendor/bin/phpunit
$ vendor/bin/phpcs -p --extensions=php --standard=Loadsys ./src ./tests

Then commit and push your changes to your fork, and open a pull request., (*10)

License

MIT, (*11)

Loadsys Web Strategies 2016, (*12)

The Versions

27/06 2016

dev-master

9999999-dev https://github.com/loadsys/CakePHP-CreatorModifier

CakePHP 3.x Plugin to set Creator and Modifier automagic fields during save.

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin user cakephp behavior creator modifier

27/06 2016

1.0.3

1.0.3.0 https://github.com/loadsys/CakePHP-CreatorModifier

CakePHP 3.x Plugin to set Creator and Modifier automagic fields during save.

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin user cakephp behavior creator modifier

12/08 2015

1.0.2

1.0.2.0 https://github.com/loadsys/CakePHP-CreatorModifier

CakePHP 3.x Plugin to set Creator and Modifier automagic fields during save.

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin user cakephp behavior creator modifier

22/07 2015

1.0.1

1.0.1.0 https://github.com/loadsys/CakePHP-CreatorModifier

CakePHP 3.x Plugin to set Creator and Modifier automagic fields during save.

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin user cakephp behavior creator modifier

22/07 2015

1.0.0

1.0.0.0 https://github.com/loadsys/CakePHP-CreatorModifier

CakePHP 3.x Plugin to set Creator and Modifier automagic fields during save.

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin user cakephp behavior creator modifier