There is a function:
public function beforeDelete($cascade = true)
This one is called, but this line returns an error:
$versions = array_keys(Configure::read('Media.filter.' . $name));
This is caused by
Configure::read('Media.filter.' . $name)
$name is "image", so the call is
Configure::read('Media.filter.image')
and this returns NULL.
So the question is, why?
In my Plugin/Media/Config/core.php I did not change these lines, so it should work?
Solved. This line
$versions = array_keys(Configure::read('Media.filter.' . $name));
should be replaced with this line
$versions = array_keys(Configure::read('Media.filter.default.' . $name));
I upload an image and generate automatically different versions. Deleting a record which has an image, should also delete all versions of this image.
So I found this tutorial: https://github.com/davidpersson/media/blob/next/docs/TUTORIAL
There is a function: public function beforeDelete($cascade = true)
This one is called, but this line returns an error: $versions = array_keys(Configure::read('Media.filter.' . $name)); This is caused by Configure::read('Media.filter.' . $name)
$name is "image", so the call is Configure::read('Media.filter.image') and this returns NULL.
So the question is, why? In my Plugin/Media/Config/core.php I did not change these lines, so it should work?
Configure::write('Media.filter', array('default' => array( 'audio' => compact('s', 'm'), 'document' => compact('s', 'm'), 'generic' => array(), 'image' => compact('s', 'm'), 'video' => compact('s', 'm') )));
Is there a problem because of CakePHP 2.0?