PHPackages                             justinatack/deleteable - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. justinatack/deleteable

Abandoned → [https://github.com/UseMuffin/Trash](/?search=https%3A%2F%2Fgithub.com%2FUseMuffin%2FTrash)Cakephp-plugin[Database &amp; ORM](/categories/database)

justinatack/deleteable
======================

Detects which database records can be deleted. Database records can be locked preventing deletion.

015PHP

Since Jan 28Pushed 11y ago1 watchersCompare

[ Source](https://github.com/justinatack/deleteable)[ Packagist](https://packagist.org/packages/justinatack/deleteable)[ RSS](/packages/justinatack-deleteable/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

CakePHP DeleteableBehavior
==========================

[](#cakephp-deleteablebehavior)

Deleteable provides a way to flag a database record as deleteable or not deleteable. I created this CakePHP Behavior with the need to be able to set a tinyint(1) "delete" field in my database and set it to true or false (0 or 1). The plugin is flexible, you can set your own field name as long as it stores a boolean value. You can also specify the value on which the delete is blocked or not. So you could have the DeleteableBehavior work when it's true and not when false (default behavior is false). The reason you might want to do this when you name your Deletable field to say "locked" and hence you might want to have "locked" field set to 1 (or true), in other words "locked" records can not be deleted because they are "locked" = true.

Requirements
------------

[](#requirements)

The master branch has the following requirements:

- CakePHP 2.2.0 or greater.
- PHP 5.3.0 or greater.

Installation
------------

[](#installation)

*\[Using [Composer](http://getcomposer.org/)\]*

From your command line you can enter

```
composer require justinatack/deleteable="*"
```

or add the plugin to your project's `composer.json` - something like this:

```
{
	"require": {
		"justinatack/deleteable": "*"
	}
}
```

Because this plugin has the type `cakephp-plugin` set in it's own `composer.json`, composer knows to install it inside your `/Plugin` directory, rather than in the usual vendors file. It is recommended that you add `/Plugin/Deleteable` to your .gitignore file. (Why? [read this](http://getcomposer.org/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md).)

> Consider using "require-dev" if you only want to include Deleteable for your development environment.

*\[Manual\]*

- Download the [Deleteable archive](https://github.com/justinatack/deleteable/archive/master.zip).
- Unzip that download.
- Rename the resulting folder to `Deleteable`
- Then copy this folder into `app/Plugin/`

*\[GIT Submodule\]*

In your app directory type:

```
git submodule add git://github.com/justinatack/deleteable.git Plugin/Deleteable
git submodule init
git submodule update
```

*\[GIT Clone\]*

In your plugin directory type

```
git clone git://github.com/justinatack/deleteable.git Deleteable
```

### Enable plugin

[](#enable-plugin)

- In 2.x you need to enable the plugin your `app/Config/bootstrap.php` file. If you are already using `CakePlugin::loadAll();`, then the following is not necessary.:

```
CakePlugin::load('Deleteable');
```

- Include the Deleteable behavior in your `app/Model/AppModel.php`:

```
class AppModel extends Model
{
    public $actsAs = array(
        'Deleteable.Deleteable',
            array(
                'field' => 'delete',
                'boolean' => false
            )
        );
}
```

- Set `field` to your database field name that you want checked by the DeleteableBehavior. Default field is set to "delete". Make sure you create a TINYINT(1) field type in MySQL.
- Set the 'boolean' value to false for default behavior or use true to flip the behavior.
- By default a boolean value of '0' will prevent a record from being deleted. A value of '1' will allow a record to be deleted. Set 'boolean' to 'true' to invert this behavior.

Reporting Issues
----------------

[](#reporting-issues)

If you have a problem with Deleteable please open an issue on [GitHub](https://github.com/justinatack/deleteable/issues).

Contributing
------------

[](#contributing)

If you'd like to contribute to Deleteable, check out the [roadmap](https://github.com/justinatack/deleteable/wiki/roadmap) for any planned features. You can [fork](https://help.github.com/articles/fork-a-repo)the project, add features, and send [pull requests](https://help.github.com/articles/using-pull-requests) or open [issues](https://github.com/justinatack/deleteable/issues).

Versions
--------

[](#versions)

Deleteable has only one release so far. Please feel free to submit a pull request to add or improve the codebase.

- '0.0.1' a working patch, the code base may well change.

License
-------

[](#license)

The MIT License (MIT)

Copyright (c) 2015 Justin Atack

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/fb53241542bcdd322d61a7ef8f2dc0d55907dfdc920edf6b898a355892704cc9?d=identicon)[justinatack](/maintainers/justinatack)

---

Top Contributors

[![justinatack](https://avatars.githubusercontent.com/u/6056502?v=4)](https://github.com/justinatack "justinatack (12 commits)")

### Embed Badge

![Health badge](/badges/justinatack-deleteable/health.svg)

```
[![Health](https://phpackages.com/badges/justinatack-deleteable/health.svg)](https://phpackages.com/packages/justinatack-deleteable)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
