Skip to content

Commit

Permalink
Add remove method refering to #23
Browse files Browse the repository at this point in the history
  • Loading branch information
bobmulder committed Sep 11, 2015
1 parent fcf65fc commit 85e9c5e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Model/Behavior/UploadableBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

use ArrayObject;
use Cake\Database\Type;
use Cake\Datasource\EntityInterface;
use Cake\Event\Event;
use Cake\Filesystem\File;
use Cake\ORM\Behavior;
Expand Down Expand Up @@ -97,6 +98,12 @@ public function __construct(Table $table, array $config = [])
$this->_Table = $table;
}

public function remove(&$entity, $field)
{
$this->_removeFile($entity->get($field));
$entity->set($field, null);
}

/**
* beforeSave callback
*
Expand Down

0 comments on commit 85e9c5e

Please sign in to comment.