mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-10 19:43:16 +00:00
#PHRAS-874 time 2d
type hinting / cs events renamed / deleted n+1 removed for status-bits & technical meta events added (subdef creation / created) fix : es indexes after all subdefs are created
This commit is contained in:
@@ -246,7 +246,7 @@ class File
|
||||
/**
|
||||
* Returns an array of AttributeInterface associated to the file
|
||||
*
|
||||
* @return array
|
||||
* @return AttributeInterface[]
|
||||
*/
|
||||
public function getAttributes()
|
||||
{
|
||||
|
@@ -20,6 +20,9 @@ use Alchemy\Phrasea\Metadata\Tag\TfBasename;
|
||||
use Alchemy\Phrasea\Metadata\Tag\TfFilename;
|
||||
use Alchemy\Phrasea\Metadata\Tag\TfRecordid;
|
||||
use Alchemy\Phrasea\Border\Attribute\Metadata as MetadataAttr;
|
||||
use Alchemy\Phrasea\Border\Attribute\MetaField as MetafieldAttr;
|
||||
use Alchemy\Phrasea\Border\Attribute\Status as StatusAttr;
|
||||
use Alchemy\Phrasea\Border\Attribute\Story as StoryAttr;
|
||||
use Alchemy\Phrasea\Model\Entities\LazaretAttribute;
|
||||
use Alchemy\Phrasea\Model\Entities\LazaretCheck;
|
||||
use Alchemy\Phrasea\Model\Entities\LazaretFile;
|
||||
@@ -314,6 +317,7 @@ class Manager
|
||||
foreach ($file->getAttributes() as $attribute) {
|
||||
switch ($attribute->getName()) {
|
||||
case AttributeInterface::NAME_METAFIELD:
|
||||
/** @var MetafieldAttr $attribute */
|
||||
$values = $attribute->getValue();
|
||||
$value = $attribute->getField()->is_multi() ? new Multi($values) : new MonoValue(array_pop($values));
|
||||
|
||||
@@ -329,14 +333,17 @@ class Manager
|
||||
break;
|
||||
|
||||
case AttributeInterface::NAME_METADATA:
|
||||
/** @var MetadataAttr $attribute */
|
||||
$newMetadata[] = $attribute->getValue();
|
||||
break;
|
||||
case AttributeInterface::NAME_STATUS:
|
||||
/** @var StatusAttr $attribute */
|
||||
$element->set_binary_status(decbin(bindec($element->get_status()) | bindec($attribute->getValue())));
|
||||
|
||||
break;
|
||||
case AttributeInterface::NAME_STORY:
|
||||
|
||||
/** @var StoryAttr $attribute */
|
||||
$story = $attribute->getValue();
|
||||
|
||||
if ( ! $story->hasChild($element)) {
|
||||
@@ -441,6 +448,8 @@ class Manager
|
||||
* to Phraseanet
|
||||
*
|
||||
* @param File $file The file
|
||||
*
|
||||
* @return Manager
|
||||
*/
|
||||
protected function addMediaAttributes(File $file)
|
||||
{
|
||||
|
@@ -1,60 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
|
||||
class AccountDeletedEvent extends Event
|
||||
{
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $userId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $login;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $emailAddress;
|
||||
|
||||
/**
|
||||
* @param int $userId
|
||||
* @param $login
|
||||
* @param string $emailAddress
|
||||
*/
|
||||
public function __construct($userId, $login, $emailAddress)
|
||||
{
|
||||
$this->userId = $userId;
|
||||
$this->login = $login;
|
||||
$this->emailAddress = $emailAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getUserId()
|
||||
{
|
||||
return $this->userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLogin()
|
||||
{
|
||||
return $this->login;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getEmailAddress()
|
||||
{
|
||||
return $this->emailAddress;
|
||||
}
|
||||
}
|
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
|
||||
class CollectionDisabled extends CollectionRelated
|
||||
{
|
||||
}
|
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
|
||||
class CollectionEmptied extends CollectionRelated
|
||||
{
|
||||
}
|
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
|
||||
class CollectionEnabled extends CollectionRelated
|
||||
{
|
||||
}
|
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
|
||||
class CollectionMounted extends CollectionRelated
|
||||
{
|
||||
}
|
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
|
||||
class CollectionRelated extends Event
|
||||
{
|
||||
/** @var \collection $collection */
|
||||
private $collection;
|
||||
/** @var array|null $args */
|
||||
protected $args;
|
||||
|
||||
/**
|
||||
* @param \collection|null $collection
|
||||
* @param array|null $args
|
||||
*/
|
||||
public function __construct(\collection $collection, array $args = null)
|
||||
{
|
||||
$this->collection = $collection;
|
||||
$this->args = $args;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \collection|null
|
||||
*/
|
||||
public function getCollection()
|
||||
{
|
||||
return $this->collection;
|
||||
}
|
||||
}
|
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
|
||||
class CollectionSettingsChanged extends CollectionRelated
|
||||
{
|
||||
public function getSettingsBefore()
|
||||
{
|
||||
return $this->args['settings_before'];
|
||||
}
|
||||
}
|
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
|
||||
class CollectionUnmounted extends CollectionRelated
|
||||
{
|
||||
public function getCollId()
|
||||
{
|
||||
return $this->args['coll_id'];
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->args['name'];
|
||||
}
|
||||
}
|
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
|
||||
class DataboxCreated extends DataboxRelated
|
||||
{
|
||||
}
|
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
|
||||
class DataboxDeleted extends DataboxRelated
|
||||
{
|
||||
public function getDbName()
|
||||
{
|
||||
return $this->args['dbname'];
|
||||
}
|
||||
}
|
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
|
||||
class DataboxMounted extends DataboxRelated
|
||||
{
|
||||
}
|
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
|
||||
class DataboxReindexAsked extends DataboxRelated
|
||||
{
|
||||
}
|
@@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
|
||||
class DataboxRelated extends Event
|
||||
{
|
||||
/** @var \databox|null $databox */
|
||||
private $databox;
|
||||
|
||||
/** @var array|null $args supplemental parameters specific to an inherited event class */
|
||||
protected $args;
|
||||
|
||||
/**
|
||||
* @param \databox|null $databox
|
||||
* @param array|null $args
|
||||
*/
|
||||
public function __construct(\databox $databox, array $args = null)
|
||||
{
|
||||
$this->databox = $databox;
|
||||
$this->args = $args;
|
||||
}
|
||||
|
||||
public function getDatabox()
|
||||
{
|
||||
return $this->databox;
|
||||
}
|
||||
}
|
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
|
||||
class DataboxStructureChanged extends DataboxRelated
|
||||
{
|
||||
public function getDomBefore()
|
||||
{
|
||||
return $this->args['dom_before'];
|
||||
}
|
||||
}
|
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
|
||||
class DataboxThesaurusChanged extends DataboxRelated
|
||||
{
|
||||
public function getDomBefore()
|
||||
{
|
||||
return $this->args['dom_before'];
|
||||
}
|
||||
}
|
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
|
||||
class DataboxTouChanged extends DataboxRelated
|
||||
{
|
||||
public function getTouBefore()
|
||||
{
|
||||
return $this->args['tou_before'];
|
||||
}
|
||||
}
|
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
|
||||
class DataboxUnmounted extends DataboxRelated
|
||||
{
|
||||
public function getDbName()
|
||||
{
|
||||
return $this->args['dbname'];
|
||||
}
|
||||
}
|
@@ -11,6 +11,6 @@
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event\Record;
|
||||
|
||||
class RecordStatusChangedEvent extends RecordEvent
|
||||
class CollectionChangedEvent extends RecordEvent
|
||||
{
|
||||
}
|
@@ -11,5 +11,5 @@
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event\Record;
|
||||
|
||||
class RecordCreatedEvent extends RecordEvent
|
||||
class CreatedEvent extends RecordEvent
|
||||
{}
|
@@ -11,6 +11,6 @@
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event\Record;
|
||||
|
||||
class RecordDeletedEvent extends RecordEvent
|
||||
class DeletedEvent extends RecordEvent
|
||||
{
|
||||
}
|
@@ -11,7 +11,7 @@
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event\Record;
|
||||
|
||||
class RecordIndexEvent extends RecordEvent
|
||||
class IndexEvent extends RecordEvent
|
||||
{
|
||||
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event\Record;
|
||||
|
||||
class MediaSubstitutedEvent extends RecordEvent
|
||||
{
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event\Record;
|
||||
|
||||
class MetadataChangedEvent extends RecordEvent
|
||||
{
|
||||
}
|
@@ -11,6 +11,6 @@
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event\Record;
|
||||
|
||||
class RecordMetadataChangedEvent extends RecordEvent
|
||||
class OriginalNameChangedEvent extends RecordEvent
|
||||
{
|
||||
}
|
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event\Record;
|
||||
|
||||
class RecordCollectionChangedEvent extends RecordEvent
|
||||
{
|
||||
}
|
@@ -21,6 +21,11 @@ final class RecordEvents
|
||||
const ORIGINAL_NAME_CHANGED = 'record.original_name_changed';
|
||||
const STATUS_CHANGED = 'record.status_changed';
|
||||
// Sub-definitions
|
||||
const SUB_DEFINITIONS_CREATION = 'record.sub_definitions_creation';
|
||||
const SUB_DEFINITION_CREATION = 'record.sub_definition_creation';
|
||||
const SUB_DEFINITION_CREATED = 'record.sub_definition_created';
|
||||
const SUB_DEFINITIONS_CREATED = 'record.sub_definitions_created';
|
||||
const SUB_DEFINITION_CREATION_FAILED = 'record.sub_definition_creation_failed';
|
||||
|
||||
const MEDIA_SUBSTITUTED = 'record.media_substituted';
|
||||
}
|
||||
|
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event\Record;
|
||||
|
||||
class RecordMediaSubstitutedEvent extends RecordEvent
|
||||
{
|
||||
}
|
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event\Record;
|
||||
|
||||
class RecordOriginalNameChangedEvent extends RecordEvent
|
||||
{
|
||||
}
|
16
lib/Alchemy/Phrasea/Core/Event/Record/StatusChangedEvent.php
Normal file
16
lib/Alchemy/Phrasea/Core/Event/Record/StatusChangedEvent.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event\Record;
|
||||
|
||||
class StatusChangedEvent extends RecordEvent
|
||||
{
|
||||
}
|
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event\Record;
|
||||
|
||||
use MediaVorus\Media\MediaInterface;
|
||||
|
||||
class SubDefinitionCreatedEvent extends RecordEvent
|
||||
{
|
||||
private $subDefinitionName;
|
||||
private $media;
|
||||
|
||||
public function __construct(\record_adapter $record, $subDefinitionName, MediaInterface $media)
|
||||
{
|
||||
parent::__construct($record);
|
||||
|
||||
$this->subDefinitionName = $subDefinitionName;
|
||||
$this->media = $media;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSubDefinitionName()
|
||||
{
|
||||
return $this->subDefinitionName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MediaInterface
|
||||
*/
|
||||
public function getMedia()
|
||||
{
|
||||
return $this->media;
|
||||
}
|
||||
}
|
@@ -11,7 +11,7 @@
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event\Record;
|
||||
|
||||
class RecordSubDefinitionCreatedEvent extends RecordEvent
|
||||
class SubDefinitionCreationEvent extends RecordEvent
|
||||
{
|
||||
private $subDefinitionName;
|
||||
|
||||
@@ -22,6 +22,9 @@ class RecordSubDefinitionCreatedEvent extends RecordEvent
|
||||
$this->subDefinitionName = $subDefinitionName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSubDefinitionName()
|
||||
{
|
||||
return $this->subDefinitionName;
|
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event\Record;
|
||||
|
||||
class SubDefinitionCreationFailedEvent extends RecordEvent
|
||||
{
|
||||
private $subDefinitionName;
|
||||
|
||||
public function __construct(\record_adapter $record, $subDefinitionName)
|
||||
{
|
||||
parent::__construct($record);
|
||||
$this->subDefinitionName = $subDefinitionName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSubDefinitionName()
|
||||
{
|
||||
return $this->subDefinitionName;
|
||||
}
|
||||
}
|
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event\Record;
|
||||
|
||||
use MediaVorus\Media\MediaInterface;
|
||||
|
||||
class SubDefinitionsCreatedEvent extends RecordEvent
|
||||
{
|
||||
/** @var MediaInterface[] */
|
||||
private $media;
|
||||
|
||||
/**
|
||||
* @param \record_adapter $record
|
||||
* @param MediaInterface[] $media
|
||||
*/
|
||||
public function __construct(\record_adapter $record, array $media)
|
||||
{
|
||||
parent::__construct($record);
|
||||
|
||||
$this->media = $media;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MediaInterface[]
|
||||
*/
|
||||
public function getMedia()
|
||||
{
|
||||
return $this->media;
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event\Record;
|
||||
|
||||
class SubDefinitionsCreationEvent extends RecordEvent
|
||||
{
|
||||
private $subDefinitionsNames;
|
||||
|
||||
public function __construct(\record_adapter $record, $subDefinitionsNames)
|
||||
{
|
||||
parent::__construct($record);
|
||||
|
||||
$this->subDefinitiosnNames = $subDefinitionsNames;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSubDefinitionsNames()
|
||||
{
|
||||
return $this->subDefinitionsNames;
|
||||
}
|
||||
}
|
@@ -12,7 +12,12 @@
|
||||
namespace Alchemy\Phrasea\Media;
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Alchemy\Phrasea\Core\Event\Record\RecordSubDefinitionCreatedEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\RecordEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\SubDefinitionCreatedEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\SubDefinitionsCreatedEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\SubDefinitionCreationEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\SubDefinitionsCreationEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\SubDefinitionCreationFailedEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\RecordEvents;
|
||||
use MediaAlchemyst\Alchemyst;
|
||||
use MediaAlchemyst\Specification\SpecificationInterface;
|
||||
@@ -38,14 +43,28 @@ class SubdefGenerator
|
||||
$this->mediavorus = $mediavorus;
|
||||
}
|
||||
|
||||
private function dispatch($eventName, RecordEvent $event)
|
||||
{
|
||||
$this->app['dispatcher']->dispatch($eventName, $event);
|
||||
}
|
||||
|
||||
public function generateSubdefs(\record_adapter $record, array $wanted_subdefs = null)
|
||||
{
|
||||
if (null === $subdefs = $record->get_databox()->get_subdef_structure()->getSubdefGroup($record->get_type())) {
|
||||
$this->logger->info(sprintf('Nothing to do for %s', $record->get_type()));
|
||||
if (null === $subdefs = $record->getDatabox()->get_subdef_structure()->getSubdefGroup($record->getType())) {
|
||||
$this->logger->info(sprintf('Nothing to do for %s', $record->getType()));
|
||||
|
||||
return;
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->dispatch(
|
||||
RecordEvents::SUB_DEFINITIONS_CREATION,
|
||||
new SubDefinitionsCreationEvent(
|
||||
$record,
|
||||
$wanted_subdefs
|
||||
)
|
||||
);
|
||||
|
||||
$mediaCreated = [];
|
||||
foreach ($subdefs as $subdef) {
|
||||
$subdefname = $subdef->get_name();
|
||||
|
||||
@@ -64,6 +83,14 @@ class SubdefGenerator
|
||||
|
||||
$pathdest = $this->generateSubdefPathname($record, $subdef, $pathdest);
|
||||
|
||||
$this->dispatch(
|
||||
RecordEvents::SUB_DEFINITION_CREATION,
|
||||
new SubDefinitionCreationEvent(
|
||||
$record,
|
||||
$subdefname
|
||||
)
|
||||
);
|
||||
|
||||
$this->logger->addInfo(sprintf('Generating subdef %s to %s', $subdefname, $pathdest));
|
||||
$this->generateSubdef($record, $subdef, $pathdest);
|
||||
|
||||
@@ -71,13 +98,37 @@ class SubdefGenerator
|
||||
$media = $this->mediavorus->guess($pathdest);
|
||||
|
||||
\media_subdef::create($this->app, $record, $subdef->get_name(), $media);
|
||||
|
||||
$this->dispatch(
|
||||
RecordEvents::SUB_DEFINITION_CREATED,
|
||||
new SubDefinitionCreatedEvent(
|
||||
$record,
|
||||
$subdefname,
|
||||
$mediaCreated[$subdefname] = $media
|
||||
)
|
||||
);
|
||||
}
|
||||
else {
|
||||
$this->dispatch(
|
||||
RecordEvents::SUB_DEFINITION_CREATION_FAILED,
|
||||
new SubDefinitionCreationFailedEvent(
|
||||
$record,
|
||||
$subdefname
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$record->clearSubdefCache($subdefname);
|
||||
|
||||
$this->app['dispatcher']->dispatch(RecordEvents::SUB_DEFINITION_CREATED, new RecordSubDefinitionCreatedEvent($record, $subdefname));
|
||||
}
|
||||
|
||||
$this->dispatch(
|
||||
RecordEvents::SUB_DEFINITIONS_CREATED,
|
||||
new SubDefinitionsCreatedEvent(
|
||||
$record,
|
||||
$mediaCreated
|
||||
)
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -92,7 +143,7 @@ class SubdefGenerator
|
||||
|
||||
$this->alchemyst->turnInto($record->get_hd_file()->getPathname(), $pathdest, $subdef_class->getSpecs());
|
||||
} catch (MediaAlchemystException $e) {
|
||||
$this->logger->error(sprintf('Subdef generation failed for record %d with message %s', $record->get_record_id(), $e->getMessage()));
|
||||
$this->logger->error(sprintf('Subdef generation failed for record %d with message %s', $record->getRecordId(), $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +155,7 @@ class SubdefGenerator
|
||||
$pathdest = \databox::dispatch($this->filesystem, $subdef->get_path());
|
||||
}
|
||||
|
||||
return $pathdest . $record->get_record_id() . '_' . $subdef->get_name() . '.' . $this->getExtensionFromSpec($subdef->getSpecs());
|
||||
return $pathdest . $record->getRecordId() . '_' . $subdef->get_name() . '.' . $this->getExtensionFromSpec($subdef->getSpecs());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -12,7 +12,7 @@
|
||||
namespace Alchemy\Phrasea\Media;
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Alchemy\Phrasea\Core\Event\Record\RecordMediaSubstitutedEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\MediaSubstitutedEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\RecordEvents;
|
||||
use MediaAlchemyst\Alchemyst;
|
||||
use MediaAlchemyst\Exception\ExceptionInterface as MediaAlchemystException;
|
||||
@@ -97,6 +97,6 @@ class SubdefSubstituer
|
||||
$record->rebuild_subdefs();
|
||||
}
|
||||
|
||||
$this->dispatcher->dispatch(RecordEvents::MEDIA_SUBSTITUTED, new RecordMediaSubstitutedEvent($record));
|
||||
$this->dispatcher->dispatch(RecordEvents::MEDIA_SUBSTITUTED, new MediaSubstitutedEvent($record));
|
||||
}
|
||||
}
|
||||
|
@@ -13,10 +13,10 @@ namespace Alchemy\Phrasea\SearchEngine\Elastic;
|
||||
|
||||
use Alchemy\Phrasea\Core\Event\Collection\CollectionEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Collection\CollectionEvents;
|
||||
use Alchemy\Phrasea\Core\Event\Record\RecordDeletedEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\DeletedEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\RecordEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\RecordEvents;
|
||||
use Alchemy\Phrasea\Core\Event\Record\RecordSubDefinitionCreatedEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\SubDefinitionsCreatedEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\Structure\RecordStructureEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\Structure\RecordStructureEvents;
|
||||
use Alchemy\Phrasea\Core\Event\Thesaurus\ThesaurusEvent;
|
||||
@@ -84,7 +84,7 @@ class IndexerSubscriber implements EventSubscriberInterface
|
||||
RecordEvents::METADATA_CHANGED => 'onRecordChange',
|
||||
RecordEvents::ORIGINAL_NAME_CHANGED => 'onRecordChange',
|
||||
RecordEvents::STATUS_CHANGED => 'onRecordChange',
|
||||
RecordEvents::SUB_DEFINITION_CREATED => 'onRecordChange',
|
||||
RecordEvents::SUB_DEFINITIONS_CREATED => 'onRecordChange',
|
||||
RecordEvents::MEDIA_SUBSTITUTED => 'onRecordChange',
|
||||
ThesaurusEvents::IMPORTED => 'onThesaurusChange',
|
||||
ThesaurusEvents::FIELD_LINKED => 'onThesaurusChange',
|
||||
@@ -120,14 +120,13 @@ class IndexerSubscriber implements EventSubscriberInterface
|
||||
|
||||
public function onRecordChange(RecordEvent $event)
|
||||
{
|
||||
if ($event instanceof RecordSubDefinitionCreatedEvent && $event->getSubDefinitionName() !== 'thumbnail') {
|
||||
return;
|
||||
if ($event instanceof SubDefinitionsCreatedEvent) {
|
||||
$record = $event->getRecord();
|
||||
$this->getIndexer()->indexRecord($record);
|
||||
}
|
||||
$record = $event->getRecord();
|
||||
$this->getIndexer()->indexRecord($record);
|
||||
}
|
||||
|
||||
public function onRecordDelete(RecordDeletedEvent $event)
|
||||
public function onRecordDelete(DeletedEvent $event)
|
||||
{
|
||||
$record = $event->getRecord();
|
||||
$this->getIndexer()->deleteRecord($record);
|
||||
|
@@ -14,6 +14,7 @@ namespace Alchemy\Phrasea\TaskManager\Job;
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Alchemy\Phrasea\Exception\RuntimeException;
|
||||
use Alchemy\Phrasea\Border\File;
|
||||
use Alchemy\Phrasea\Border\Manager as borderManager;
|
||||
use Alchemy\Phrasea\TaskManager\Editor\ArchiveEditor;
|
||||
use Alchemy\Phrasea\Metadata\Tag as PhraseaTag;
|
||||
use Alchemy\Phrasea\Border\Attribute as BorderAttribute;
|
||||
@@ -1080,7 +1081,9 @@ class ArchiveJob extends AbstractJob
|
||||
$record = $element;
|
||||
};
|
||||
|
||||
$app['border-manager']->process($this->getLazaretSession($app), $file, $postProcess, $force);
|
||||
/** @var borderManager $borderManager */
|
||||
$borderManager = $app['border-manager'];
|
||||
$borderManager->process($this->getLazaretSession($app), $file, $postProcess, $force);
|
||||
|
||||
return $record;
|
||||
}
|
||||
|
@@ -114,25 +114,16 @@ class SubdefsJob extends AbstractJob
|
||||
$this->log('warning', sprintf("Generate subdefs failed for : sbasid=%s / databox=%s / recordid=%s : %s", $databox->get_sbas_id(), $databox->get_dbname() , $row['record_id'], $e->getMessage()));
|
||||
}
|
||||
|
||||
// subdef created, ask to rewrite metadata
|
||||
$sql = 'UPDATE record'
|
||||
. ' SET jeton=(jeton & ~(:flag)), moddate=NOW()'
|
||||
. ' SET jeton=(jeton & ~(:flag_and)) | :flag_or, moddate=NOW()'
|
||||
. ' WHERE record_id=:record_id';
|
||||
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute([
|
||||
':record_id' => $row['record_id'],
|
||||
':flag' => PhraseaTokens::MAKE_SUBDEF
|
||||
]);
|
||||
$stmt->closeCursor();
|
||||
|
||||
// rewrite metadata
|
||||
$sql = 'UPDATE record'
|
||||
. ' SET jeton=(jeton | :flag)'
|
||||
. ' WHERE record_id=:record_id';
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute([
|
||||
':record_id' => $row['record_id'],
|
||||
':flag' => (PhraseaTokens::WRITE_META_SUBDEF | PhraseaTokens::TO_INDEX)
|
||||
':flag_and' => PhraseaTokens::MAKE_SUBDEF,
|
||||
':flag_or' => (PhraseaTokens::WRITE_META_SUBDEF | PhraseaTokens::TO_INDEX)
|
||||
]);
|
||||
$stmt->closeCursor();
|
||||
|
||||
|
@@ -271,7 +271,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Find a substitution file for a sibdef
|
||||
* Find a substitution file for a subdef
|
||||
*
|
||||
* @return \media_subdef
|
||||
*/
|
||||
@@ -476,7 +476,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
|
||||
|
||||
/**
|
||||
*
|
||||
* @return id
|
||||
* @return int
|
||||
*/
|
||||
public function get_subdef_id()
|
||||
{
|
||||
@@ -678,6 +678,8 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
|
||||
$newname = $media->getFile()->getFilename();
|
||||
|
||||
$params = [
|
||||
':record_id' => $record->getRecordId(),
|
||||
':name' => $name,
|
||||
':path' => $path,
|
||||
':file' => $newname,
|
||||
':width' => 0,
|
||||
@@ -694,36 +696,13 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
|
||||
$params[':height'] = $media->getHeight();
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
$sql = "SELECT subdef_id FROM subdef WHERE record_id = :record_id AND name = :name";
|
||||
$stmt = $connbas->prepare($sql);
|
||||
$stmt->execute([
|
||||
':record_id' => $record->getRecordId(),
|
||||
':name' => $name,
|
||||
]);
|
||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
if (! $row) {
|
||||
throw new \Exception_Media_SubdefNotFound('Require the real one');
|
||||
}
|
||||
|
||||
$sql = "UPDATE subdef"
|
||||
. " SET path = :path, file = :file,"
|
||||
. " width = :width , height = :height, mime = :mime,"
|
||||
. " size = :size, dispatched = :dispatched, updated_on = NOW()"
|
||||
. " WHERE subdef_id = :subdef_id";
|
||||
|
||||
$params[':subdef_id'] = $row['subdef_id'];
|
||||
} catch (\Exception_Media_SubdefNotFound $e) {
|
||||
$sql = "INSERT INTO subdef"
|
||||
. " (record_id, name, path, file, width, height, mime, size, dispatched, created_on, updated_on)"
|
||||
. " VALUES (:record_id, :name, :path, :file, :width, :height, :mime, :size, :dispatched, NOW(), NOW())";
|
||||
|
||||
$params[':record_id'] = $record->getRecordId();
|
||||
$params[':name'] = $name;
|
||||
}
|
||||
$sql = "INSERT INTO subdef"
|
||||
. " (record_id, name, path, file, width, height, mime, size, dispatched, created_on, updated_on)"
|
||||
. " VALUES (:record_id, :name, :path, :file, :width, :height, :mime, :size, :dispatched, NOW(), NOW())"
|
||||
. " ON DUPLICATE KEY UPDATE"
|
||||
. " path = VALUES(path), file = VALUES(file),"
|
||||
. " width = VALUES(width) , height = VALUES(height), mime = VALUES(mime),"
|
||||
. " size = VALUES(size), dispatched = VALUES(dispatched), updated_on = NOW()";
|
||||
|
||||
$stmt = $connbas->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
|
@@ -12,14 +12,14 @@
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Alchemy\Phrasea\Border\File;
|
||||
use Alchemy\Phrasea\Cache\Exception;
|
||||
use Alchemy\Phrasea\Core\Event\Record\RecordCollectionChangedEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\RecordCreatedEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\RecordDeletedEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\CollectionChangedEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\CreatedEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\DeletedEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\RecordEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\RecordEvents;
|
||||
use Alchemy\Phrasea\Core\Event\Record\RecordMetadataChangedEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\RecordOriginalNameChangedEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\RecordStatusChangedEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\MetadataChangedEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\OriginalNameChangedEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\StatusChangedEvent;
|
||||
use Alchemy\Phrasea\Core\PhraseaTokens;
|
||||
use Alchemy\Phrasea\Media\ArrayTechnicalDataSet;
|
||||
use Alchemy\Phrasea\Media\FloatTechnicalData;
|
||||
@@ -38,8 +38,10 @@ use Doctrine\ORM\EntityManager;
|
||||
use MediaVorus\Media\MediaInterface;
|
||||
use MediaVorus\MediaVorus;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\HttpFoundation\File\File as SymfoFile;
|
||||
|
||||
|
||||
class record_adapter implements RecordInterface, cache_cacheableInterface
|
||||
{
|
||||
const CACHE_ORIGINAL_NAME = 'originalname';
|
||||
@@ -453,7 +455,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
||||
|
||||
$this->delete_data_from_cache();
|
||||
|
||||
$this->dispatch(RecordEvents::COLLECTION_CHANGED, new RecordCollectionChangedEvent($this));
|
||||
$this->dispatch(RecordEvents::COLLECTION_CHANGED, new CollectionChangedEvent($this));
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -463,7 +465,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
||||
*/
|
||||
public function get_rollover_thumbnail()
|
||||
{
|
||||
if ($this->get_type() != 'video') {
|
||||
if ($this->getType() != 'video') {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -793,7 +795,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
||||
|
||||
$this->delete_data_from_cache();
|
||||
|
||||
$this->dispatch(RecordEvents::ORIGINAL_NAME_CHANGED, new RecordOriginalNameChangedEvent($this));
|
||||
$this->dispatch(RecordEvents::ORIGINAL_NAME_CHANGED, new OriginalNameChangedEvent($this));
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -896,15 +898,18 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
||||
{
|
||||
$newfilename = $this->record_id . '_0_' . $name . '.' . $media->getFile()->getExtension();
|
||||
|
||||
/** @var Filesystem $filesystem */
|
||||
$filesystem = $app['filesystem'];
|
||||
|
||||
if ($name == 'document') {
|
||||
$baseprefs = $this->getDatabox()->get_sxml_structure();
|
||||
|
||||
$pathhd = p4string::addEndSlash((string) ($baseprefs->path));
|
||||
|
||||
$filehd = $this->getRecordId() . "_document." . strtolower($media->getFile()->getExtension());
|
||||
$pathhd = databox::dispatch($app['filesystem'], $pathhd);
|
||||
$pathhd = databox::dispatch($filesystem, $pathhd);
|
||||
|
||||
$app['filesystem']->copy($media->getFile()->getRealPath(), $pathhd . $filehd, true);
|
||||
$filesystem->copy($media->getFile()->getRealPath(), $pathhd . $filehd, true);
|
||||
|
||||
$subdefFile = $pathhd . $filehd;
|
||||
|
||||
@@ -920,8 +925,8 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
||||
$this->get_subdef($name)->remove_file();
|
||||
$this->clearSubdefCache($name);
|
||||
} else {
|
||||
$path = databox::dispatch($app['filesystem'], $subdef_def->get_path());
|
||||
$app['filesystem']->mkdir($path, 0750);
|
||||
$path = databox::dispatch($filesystem, $subdef_def->get_path());
|
||||
$filesystem->mkdir($path, 0750);
|
||||
$path_file_dest = $path . $newfilename;
|
||||
}
|
||||
|
||||
@@ -939,7 +944,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
||||
$subdefFile = $path_file_dest;
|
||||
}
|
||||
else{
|
||||
$app['filesystem']->copy($media->getFile()->getRealPath(), $path_file_dest);
|
||||
$filesystem->copy($media->getFile()->getRealPath(), $path_file_dest);
|
||||
|
||||
$subdefFile = $path_file_dest;
|
||||
}
|
||||
@@ -947,7 +952,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
||||
$meta_writable = $subdef_def->meta_writeable();
|
||||
}
|
||||
|
||||
$app['filesystem']->chmod($subdefFile, 0760);
|
||||
$filesystem->chmod($subdefFile, 0760);
|
||||
$media = $app->getMediaFromUri($subdefFile);
|
||||
$subdef = media_subdef::create($app, $this, $name, $media);
|
||||
$subdef->set_substituted(true);
|
||||
@@ -1076,7 +1081,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
||||
$this->set_xml($xml);
|
||||
unset($xml);
|
||||
|
||||
$this->dispatch(RecordEvents::METADATA_CHANGED, new RecordMetadataChangedEvent($this));
|
||||
$this->dispatch(RecordEvents::METADATA_CHANGED, new MetadataChangedEvent($this));
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -1158,23 +1163,28 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
||||
['status' => bindec($status), 'record_id' => $this->record_id]
|
||||
);
|
||||
|
||||
$sql = 'REPLACE INTO status (id, record_id, name, value) VALUES (null, :record_id, :name, :value)';
|
||||
$stmt = $connection->prepare($sql);
|
||||
|
||||
$status = strrev($status);
|
||||
$length = strlen($status);
|
||||
$sqlValues = [];
|
||||
for ($i = 4; $i < $length; $i++) {
|
||||
$stmt->execute([
|
||||
':record_id' => $this->getRecordId(),
|
||||
':name' => $i,
|
||||
':value' => $status[$i]
|
||||
]);
|
||||
$sqlValues[] = join(',', array(
|
||||
'null',
|
||||
$connection->quote($this->getRecordId()),
|
||||
$connection->quote($i),
|
||||
$connection->quote($status[$i])
|
||||
));
|
||||
}
|
||||
$sql = "REPLACE INTO status (id, record_id, name, value)"
|
||||
. " VALUES (" . join('),(', $sqlValues) . ")";
|
||||
$stmt = $connection->prepare($sql);
|
||||
|
||||
$stmt->execute();
|
||||
|
||||
$stmt->closeCursor();
|
||||
|
||||
$this->delete_data_from_cache(self::CACHE_STATUS);
|
||||
|
||||
$this->dispatch(RecordEvents::STATUS_CHANGED, new RecordStatusChangedEvent($this));
|
||||
$this->dispatch(RecordEvents::STATUS_CHANGED, new StatusChangedEvent($this));
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -1231,7 +1241,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
||||
unset($e);
|
||||
}
|
||||
|
||||
$story->dispatch(RecordEvents::CREATED, new RecordCreatedEvent($story));
|
||||
$story->dispatch(RecordEvents::CREATED, new CreatedEvent($story));
|
||||
|
||||
return $story;
|
||||
}
|
||||
@@ -1285,10 +1295,13 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
||||
unset($e);
|
||||
}
|
||||
|
||||
$pathhd = databox::dispatch($app['filesystem'], trim($databox->get_sxml_structure()->path));
|
||||
/** @var Filesystem $filesystem */
|
||||
$filesystem = $app['filesystem'];
|
||||
|
||||
$pathhd = databox::dispatch($filesystem, trim($databox->get_sxml_structure()->path));
|
||||
$newname = $record->getRecordId() . "_document." . pathinfo($file->getOriginalName(), PATHINFO_EXTENSION);
|
||||
|
||||
$app['filesystem']->copy($file->getFile()->getRealPath(), $pathhd . $newname, true);
|
||||
$filesystem->copy($file->getFile()->getRealPath(), $pathhd . $newname, true);
|
||||
|
||||
$media = $app->getMediaFromUri($pathhd . $newname);
|
||||
media_subdef::create($app, $record, 'document', $media);
|
||||
@@ -1297,7 +1310,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
||||
|
||||
$record->insertTechnicalDatas($app['mediavorus']);
|
||||
|
||||
$record->dispatch(RecordEvents::CREATED, new RecordCreatedEvent($record));
|
||||
$record->dispatch(RecordEvents::CREATED, new CreatedEvent($record));
|
||||
|
||||
return $record;
|
||||
}
|
||||
@@ -1316,15 +1329,13 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
$connection = $this->getDatabox()->get_connection();
|
||||
$sql = 'DELETE FROM technical_datas WHERE record_id = :record_id';
|
||||
$stmt = $this->getDatabox()->get_connection()->prepare($sql);
|
||||
$stmt = $connection->prepare($sql);
|
||||
$stmt->execute([':record_id' => $this->getRecordId()]);
|
||||
$stmt->closeCursor();
|
||||
|
||||
$sql = "INSERT INTO technical_datas (id, record_id, name, value)"
|
||||
. " VALUES (null, :record_id, :name, :value)";
|
||||
$stmt = $this->getDatabox()->get_connection()->prepare($sql);
|
||||
|
||||
$sqlValues = [];
|
||||
foreach ($document->readTechnicalDatas($mediavorus) as $name => $value) {
|
||||
if (is_null($value)) {
|
||||
continue;
|
||||
@@ -1335,13 +1346,19 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
||||
$value = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$stmt->execute([
|
||||
':record_id' => $this->getRecordId()
|
||||
, ':name' => $name
|
||||
, ':value' => $value
|
||||
]);
|
||||
$sqlValues[] = join(',', array(
|
||||
'null',
|
||||
$connection->quote($this->getRecordId()),
|
||||
$connection->quote($name),
|
||||
$connection->quote($value)
|
||||
));
|
||||
}
|
||||
$sql = "INSERT INTO technical_datas (id, record_id, name, value)"
|
||||
. " VALUES (" . join('),(', $sqlValues) . ")";
|
||||
;
|
||||
$stmt = $connection->prepare($sql);
|
||||
|
||||
$stmt->execute();
|
||||
|
||||
$stmt->closeCursor();
|
||||
|
||||
@@ -1510,7 +1527,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
||||
|
||||
$this->delete_data_from_cache(self::CACHE_SUBDEFS);
|
||||
|
||||
$this->dispatch(RecordEvents::DELETED, new RecordDeletedEvent($this));
|
||||
$this->dispatch(RecordEvents::DELETED, new DeletedEvent($this));
|
||||
|
||||
return array_keys($ftodel);
|
||||
}
|
||||
|
Reference in New Issue
Block a user