I have this Bundle working on my Symfony2 app. Images are well uploaded, but the listener for persist the filename to the SQL table is not called on method onUpload.
Is strange, because all looks to be in order...
This is my services.yml
services:
luisma.upload_listener:
class: "LuismaBundle\Services\UploadListener"
arguments: [@doctrine]
tags:
- { name: 'kernel.event_listener', event: oneup_uploader.post_persist, method: onUpload }
And this is my Listener:
<?php
namespace LuismaBundle\Services;
use Oneup\UploaderBundle\Event\PostPersistEvent;
use LuismaBundle\Entity\MotorsAdsFile;
class UploadListener
{
protected $manager;
public function __construct(EntityManager $manager)
{
$this->manager = $manager;
}
public function onUpload(PostPersistEvent $event)
{
$file = $event->getFile();
$object = new MotorsAdsFile();
$object->setFilename($file->getPathName());
$this->manager->persist($object);
$this->manager->flush();
}
}
Could be great if somebody can give any suggestion! Thanks in advance!!
Symfony 3.1.2
(UploadListener is not called, but uploads work fine). Did you get any solution for your problem? – Mort