2017 © Pedro Peláez
 

cakephp-plugin delete

Delete plugin for CakePHP

image

kicaj/delete

Delete plugin for CakePHP

  • Sunday, April 15, 2018
  • by kicaj
  • Repository
  • 1 Watchers
  • 0 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

CakePHP plugin for soft deleting

Build Status Scrutinizer Code Quality LICENSE Releases, (*1)

This Delete plugin enable soft deletable. Entities aren't removed from your database. Instead, a deleted timestamp is set on the record., (*2)

Requirements

It is developed for CakePHP 4.x., (*3)

Installation

You can install plugin into your CakePHP application using composer., (*4)

The recommended way to install composer packages is:, (*5)

composer require slicesofcake/delete

Load the Behavior

Load the Behavior in your src/Model/Table/YourTable.php (or if you have AppTable.php). The default field named in database table should be deleted (like created or modified) and compatible type with Time::now() (eg. DATE or DATETIME)., (*6)

public function initialize(array $config)
{
    parent::initialize($config);

    $this->addBehavior('SlicesCake/Delete.Deleted');
}

You can configuration to customize the Delete plugin:, (*7)

$this->addBehavior('SlicesCake/Delete.Deleted', [
    'field' => 'deleted_at', // Change column field name
]);

Add column by Migrations plugin

  1. Load Migrations plugin (https://github.com/cakephp/migrations).
  2. Copy file from /vendor/slicesofcake/delete/config/20200101122906_AddDeletedToProducts.example.php to your app main config directory.
  3. Rename to 20200101122906_AddDeletedTo[YourTable].php.
  4. Edit file and rename class with changes above.
  5. Update change method to set table name.
  6. Run migrations by command: cake migrations migrate

The Versions

15/04 2018

dev-master

9999999-dev

Delete plugin for CakePHP

  Sources   Download

MIT

The Requires

 

by Avatar kicaj

20/01 2018

1.0.0

1.0.0.0

Delete plugin for CakePHP

  Sources   Download

MIT

The Requires

 

by Avatar kicaj