1.0
1.0.0.0Small package to handle file uploads via a save to a Flysystem Handler
MIT
The Requires
by Ross Riley
dev-master
9999999-devSmall package to handle file uploads via a save to a Flysystem Handler
MIT
The Requires
by Ross Riley
Wallogit.com
2017 © Pedro Peláez
Small package to handle file uploads via a save to a Flysystem Handler
This is a very basic composer package designed to slot into an existing Doctrine ORM based project., (*1)
The listener takes care of handling file uploads and saves the resulting path to the Entity., (*2)
This is an array in the format Entity\Class=>[field1,field2] for example., (*3)
$targets = [
'Myproject\Entity\User' => ['logo','profilepic'],
'Myproject\Entity\Company' => ['logo']
];
This project uses Flysystem(http://flysystem.thephpleague.com) to handle saves. The simplest usage is as follows., (*4)
$fsAdapter = new League\Flysystem\Adapter\Local('/path/to/save');
$filesystem = new League\Flysystem\Filesystem($fsAdapter);
$handler = Handler($filesystem);
use Doctrine\Uploader\Listener; $em->getEventManager()->addEventListener([Doctrine\ORM\Events::preUpdate], new Listener($handler, $targets));
use League\Flysystem\Adapter\Local;
use League\Flysystem\Filesystem;
use Doctrine\Uploader\Listener;
use Doctrine\Uploader\Handler;
$targets = [
'Myproject\Entity\User' => ['logo','profilepic'],
'Myproject\Entity\Company' => ['logo']
];
$fsAdapter = new Local('/path/to/save');
$filesystem = new Filesystem($fsAdapter);
$handler = Handler($filesystem);
$em->getEventManager()->addEventListener([Doctrine\ORM\Events::preUpdate], new Listener($handler, $targets));
Small package to handle file uploads via a save to a Flysystem Handler
MIT
Small package to handle file uploads via a save to a Flysystem Handler
MIT