2017 © Pedro Peláez
 

cakephp-plugin reincarnation

CakePHP Reincarnation

image

fusic/reincarnation

CakePHP Reincarnation

  • Friday, May 18, 2018
  • by fusic
  • Repository
  • 18 Watchers
  • 2 Stars
  • 11,677 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 13 Versions
  • 31 % Grown

The README.md

Reincarnation

Description

Soft delete plugin for CakePHP 5.x., (*1)

Requirements

  • PHP >= 8.1.*
  • CakePHP >= 5.*

Installation

$ composer install

Usage

Create users table., (*2)


CREATE TABLE users ( id serial NOT NULL, username text, password text, created timestamp without time zone, modified timestamp without time zone, delete_flg boolean DEFAULT false, deleted timestamp with time zone, CONSTRAINT users_pkey PRIMARY KEY (id) ) WITH ( OIDS=FALSE );

UsersTable.php, (*3)

class UsersTable extends Table
{
    public function initialize(array $config)
    {
        // Case 1
        // default
        //   table field name
        //     boolean:deleted
        //     timestamp:delete_date
        $this->addBehavior('Reincarnation.SoftDelete');

        // Case 2
        // field name custom
        //   table field name
        //     boolean:delete_flg
        //     timestamp:deleted
        $this->addBehavior('Reincarnation.SoftDelete', ['boolean' => 'delete_flg', 'timestamp' => 'deleted']);

        // Case 3
        // boolean only
        //   table field name
        //     boolean:delete_flg
        //     timestamp:none
        $this->addBehavior('Reincarnation.SoftDelete', ['boolean' => 'delete_flg', 'timestamp' => false]);

        // Case 4
        // timestamp only
        //   table field name
        //     boolean:none
        //     timestamp:deleted
        $this->addBehavior('Reincarnation.SoftDelete', ['boolean' => false, 'timestamp' => 'deleted']);
    }
}

UsersController.php, (*4)

class UsersController extends AppController
{
    public function delete($id = null)
    {
        $this->request->allowMethod(['post', 'delete']);
        $user = $this->Users->get($id);
        if ($this->Users->softDelete($user)) {
        //第二引数がtrueの場合、Entityのassociate先もあわせて削除します
        //if ($this->Users->softDelete($user, true)) {
            $this->Flash->success(__('The data has been deleted.'));
        } else {
            $this->Flash->error(__('The data could not be deleted. Please, try again.'));
        }
        return $this->redirect('action' => 'index');
    }
}

The Versions

18/05 2018

dev-master

9999999-dev https://github.com/fusic/Reincarnation

CakePHP Reincarnation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar fusic

cakephp soft delete

18/05 2018

1.2.0

1.2.0.0 https://github.com/fusic/Reincarnation

CakePHP Reincarnation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar fusic

cakephp soft delete

18/05 2018

dev-fixWarning

dev-fixWarning https://github.com/fusic/Reincarnation

CakePHP Reincarnation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar fusic

cakephp soft delete

05/08 2016

1.1.1

1.1.1.0 https://github.com/fusic/Reincarnation

CakePHP Reincarnation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar fusic

cakephp soft delete

16/06 2016

1.1.0

1.1.0.0 https://github.com/fusic/Reincarnation

CakePHP Reincarnation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar fusic

cakephp soft delete

16/06 2016

dev-associate_add_and_transaction_delete

dev-associate_add_and_transaction_delete https://github.com/fusic/Reincarnation

CakePHP Reincarnation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar fusic

cakephp soft delete

26/05 2016

1.0.4

1.0.4.0 https://github.com/fusic/Reincarnation

CakePHP Reincarnation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar fusic

cakephp soft delete

25/04 2016

1.0.3

1.0.3.0 https://github.com/fusic/Reincarnation

CakePHP Reincarnation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar fusic

cakephp soft delete

25/04 2016

dev-mysql_datetime_patch

dev-mysql_datetime_patch https://github.com/fusic/Reincarnation

CakePHP Reincarnation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar fusic

cakephp soft delete

12/04 2016

1.0.2

1.0.2.0 https://github.com/fusic/Reincarnation

CakePHP Reincarnation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar fusic

cakephp soft delete

25/02 2016

1.0.1

1.0.1.0 https://github.com/fusic/Reincarnation

CakePHP Reincarnation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar fusic

cakephp soft delete

25/02 2016

dev-freedom_logical_delete_column_name

dev-freedom_logical_delete_column_name https://github.com/fusic/Reincarnation

CakePHP Reincarnation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar fusic

cakephp soft delete

16/02 2016

1.0.0

1.0.0.0 https://github.com/fusic/Reincarnation

CakePHP Reincarnation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar fusic

cakephp soft delete