/** * Every time the image is saved, the file is renamed. This eliminate the * need to handle cache busting in the browser. * * @param \Cake\Event\Event $event The beforeSave event that was fired * @param \Cake\Datasource\EntityInterface $entity The entity that is going to be saved * @param \ArrayObject $options the options passed to the save method * @return void */ public function beforeSave(Event $event, Entity $entity, ArrayObject $options) { $entity->set('uniqid', uniqid()); parent::beforeSave($event, $entity, $options); }