mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Remove references to old async upload bundle
This commit is contained in:
parent
45e1ce034a
commit
f131572344
@ -12,7 +12,6 @@
|
|||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"ext-openssl": "*",
|
"ext-openssl": "*",
|
||||||
"ext-redis": "*",
|
"ext-redis": "*",
|
||||||
"champs-libres/async-uploader-bundle": "dev-sf4#d57134aee8e504a83c902ff0cf9f8d36ac418290",
|
|
||||||
"champs-libres/wopi-bundle": "dev-master@dev",
|
"champs-libres/wopi-bundle": "dev-master@dev",
|
||||||
"champs-libres/wopi-lib": "dev-master@dev",
|
"champs-libres/wopi-lib": "dev-master@dev",
|
||||||
"doctrine/doctrine-bundle": "^2.1",
|
"doctrine/doctrine-bundle": "^2.1",
|
||||||
|
@ -36,7 +36,6 @@ class ChillDocStoreExtension extends Extension implements PrependExtensionInterf
|
|||||||
|
|
||||||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config'));
|
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config'));
|
||||||
$loader->load('services.yaml');
|
$loader->load('services.yaml');
|
||||||
$loader->load('services/media.yaml');
|
|
||||||
$loader->load('services/controller.yaml');
|
$loader->load('services/controller.yaml');
|
||||||
$loader->load('services/menu.yaml');
|
$loader->load('services/menu.yaml');
|
||||||
$loader->load('services/fixtures.yaml');
|
$loader->load('services/fixtures.yaml');
|
||||||
|
@ -11,7 +11,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\DocStoreBundle\Entity;
|
namespace Chill\DocStoreBundle\Entity;
|
||||||
|
|
||||||
use ChampsLibres\AsyncUploaderBundle\Model\AsyncFileInterface;
|
|
||||||
use Chill\DocStoreBundle\Validator\Constraints\AsyncFileExists;
|
use Chill\DocStoreBundle\Validator\Constraints\AsyncFileExists;
|
||||||
use ChampsLibres\WopiLib\Contract\Entity\Document;
|
use ChampsLibres\WopiLib\Contract\Entity\Document;
|
||||||
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
|
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
|
||||||
@ -33,7 +32,7 @@ use Symfony\Component\Serializer\Annotation as Serializer;
|
|||||||
* message="The file is not stored properly"
|
* message="The file is not stored properly"
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
class StoredObject implements AsyncFileInterface, Document, TrackCreationInterface
|
class StoredObject implements Document, TrackCreationInterface
|
||||||
{
|
{
|
||||||
use TrackCreationTrait;
|
use TrackCreationTrait;
|
||||||
final public const STATUS_READY = 'ready';
|
final public const STATUS_READY = 'ready';
|
||||||
|
@ -1,47 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Chill is a software for social workers
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view
|
|
||||||
* the LICENSE file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Chill\DocStoreBundle\Object;
|
|
||||||
|
|
||||||
use ChampsLibres\AsyncUploaderBundle\Form\AsyncFileTransformer\AsyncFileTransformerInterface;
|
|
||||||
use ChampsLibres\AsyncUploaderBundle\Model\AsyncFileInterface;
|
|
||||||
use Chill\DocStoreBundle\Entity\StoredObject;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
|
|
||||||
class ObjectToAsyncFileTransformer implements AsyncFileTransformerInterface
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var EntityManagerInterface
|
|
||||||
*/
|
|
||||||
protected $em;
|
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $em)
|
|
||||||
{
|
|
||||||
$this->em = $em;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function toAsyncFile($data)
|
|
||||||
{
|
|
||||||
if ($data instanceof StoredObject) {
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function toData(AsyncFileInterface $asyncFile)
|
|
||||||
{
|
|
||||||
$object = $this->em
|
|
||||||
->getRepository(StoredObject::class)
|
|
||||||
->findByFilename($asyncFile->getObjectName());
|
|
||||||
|
|
||||||
return $object ?? (new StoredObject())
|
|
||||||
->setFilename($asyncFile->getObjectName());
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Chill is a software for social workers
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view
|
|
||||||
* the LICENSE file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Chill\DocStoreBundle\Object;
|
|
||||||
|
|
||||||
use ChampsLibres\AsyncUploaderBundle\Persistence\PersistenceCheckerInterface;
|
|
||||||
use Chill\DocStoreBundle\Entity\StoredObject;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
|
|
||||||
class PersistenceChecker implements PersistenceCheckerInterface
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var EntityManagerInterface
|
|
||||||
*/
|
|
||||||
protected $em;
|
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $em)
|
|
||||||
{
|
|
||||||
$this->em = $em;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function isPersisted($object_name): bool
|
|
||||||
{
|
|
||||||
$qb = $this->em->createQueryBuilder();
|
|
||||||
$qb->select('COUNT(m)')
|
|
||||||
->from(StoredObject::class, 'm')
|
|
||||||
->where($qb->expr()->eq('m.filename', ':object_name'))
|
|
||||||
->setParameter('object_name', $object_name);
|
|
||||||
|
|
||||||
return 1 === $qb->getQuery()->getSingleScalarResult();
|
|
||||||
}
|
|
||||||
}
|
|
@ -11,7 +11,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\DocStoreBundle\Tests;
|
namespace Chill\DocStoreBundle\Tests;
|
||||||
|
|
||||||
use ChampsLibres\AsyncUploaderBundle\TempUrl\TempUrlGeneratorInterface;
|
use Chill\DocStoreBundle\AsyncUpload\SignedUrl;
|
||||||
|
use Chill\DocStoreBundle\AsyncUpload\TempUrlGeneratorInterface;
|
||||||
use Chill\DocStoreBundle\Entity\StoredObject;
|
use Chill\DocStoreBundle\Entity\StoredObject;
|
||||||
use Chill\DocStoreBundle\Exception\StoredObjectManagerException;
|
use Chill\DocStoreBundle\Exception\StoredObjectManagerException;
|
||||||
use Chill\DocStoreBundle\Service\StoredObjectManager;
|
use Chill\DocStoreBundle\Service\StoredObjectManager;
|
||||||
@ -163,8 +164,11 @@ final class StoredObjectManagerTest extends TestCase
|
|||||||
|
|
||||||
private function getTempUrlGenerator(StoredObject $storedObject): TempUrlGeneratorInterface
|
private function getTempUrlGenerator(StoredObject $storedObject): TempUrlGeneratorInterface
|
||||||
{
|
{
|
||||||
$response = new \stdClass();
|
$response = new SignedUrl(
|
||||||
$response->url = $storedObject->getFilename();
|
'PUT',
|
||||||
|
'https://example.com/'.$storedObject->getFilename(),
|
||||||
|
new \DateTimeImmutable('1 hours')
|
||||||
|
);
|
||||||
|
|
||||||
$tempUrlGenerator = $this->createMock(TempUrlGeneratorInterface::class);
|
$tempUrlGenerator = $this->createMock(TempUrlGeneratorInterface::class);
|
||||||
|
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
services:
|
|
||||||
chill_doc_store.persistence_checker:
|
|
||||||
class: Chill\DocStoreBundle\Object\PersistenceChecker
|
|
||||||
arguments:
|
|
||||||
$em: '@Doctrine\ORM\EntityManagerInterface'
|
|
||||||
|
|
||||||
Chill\DocStoreBundle\Object\ObjectToAsyncFileTransformer:
|
|
||||||
arguments:
|
|
||||||
$em: '@Doctrine\ORM\EntityManagerInterface'
|
|
Loading…
x
Reference in New Issue
Block a user