mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 23:13:15 +00:00
This is a combination of 33 commits.
- Squashed Pull request #1730 - Squashed Pull request #1741 - Squashed Pull request #1742 - Squash merge branch 4.0 - Squashed Pull request #1744 - Squashed Pull request #1746 - Squashed merge branch 4.0 - Squashed merge branch 4.0 - Squashed merge branch 4.0 - Squashed merge branch 4.0 - Squashed Pull request #1758 - Avoid using imagine/imagine alias as it is causing install issues - Squashed merge branch 4.0 - Squashed Pull request #1763 - Squashed merge branch 4.0 - Squash of 6 commits - Squashed merge branch 4.0 - This is a combination of 2 commits. - Squashed Pull request #1775 - Squashed Pull request #1777 - Squashed Pull request #1779 - Squashed Pull request #1780 - Squashed Pull request #1782 - Adds a Pull request template - Squased Pull request #1783 - Squash Pull request #1786 - Squashed Pull request #1796 - Squashed merge branch 4.0 - Squash Pull request #1791 - Squashed merge branch 4.0 - Squashed Pull request #1808 - Squashed Pull request #1811 - Squashed Pull request #1809
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
@@ -15,10 +14,9 @@ use Alchemy\Phrasea\Core\Event\Record\Structure\FieldEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\Structure\FieldUpdatedEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\Structure\RecordStructureEvents;
|
||||
use Alchemy\Phrasea\Metadata\TagFactory;
|
||||
use Alchemy\Phrasea\Vocabulary;
|
||||
use Alchemy\Phrasea\Vocabulary\ControlProvider\ControlProviderInterface;
|
||||
use Alchemy\Phrasea\Metadata\Tag\NoSource;
|
||||
use Doctrine\DBAL\Driver\Connection;
|
||||
use Doctrine\DBAL\Connection;
|
||||
use PHPExiftool\Exception\TagUnknown;
|
||||
use Alchemy\Phrasea\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
@@ -78,9 +76,24 @@ class databox_field implements cache_cacheableInterface
|
||||
'Type' => 'databox_Field_DCES_Type',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var databox_Field_DCESAbstract|null
|
||||
*/
|
||||
protected $dces_element;
|
||||
|
||||
/**
|
||||
* @var ControlProviderInterface|null
|
||||
*/
|
||||
protected $Vocabulary;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
protected $VocabularyType;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $VocabularyRestriction = false;
|
||||
protected $on_error = false;
|
||||
protected $original_src;
|
||||
@@ -504,7 +517,6 @@ class databox_field implements cache_cacheableInterface
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return databox_Field_DCESAbstract
|
||||
*/
|
||||
public function get_dces_element()
|
||||
@@ -514,29 +526,25 @@ class databox_field implements cache_cacheableInterface
|
||||
|
||||
public function set_dces_element(databox_Field_DCESAbstract $DCES_element = null)
|
||||
{
|
||||
$connbas = $this->get_connection();
|
||||
|
||||
$connection = $this->get_connection();
|
||||
|
||||
if (null !== $DCES_element) {
|
||||
$sql = 'UPDATE metadatas_structure
|
||||
SET dces_element = null WHERE dces_element = :dces_element';
|
||||
|
||||
$stmt = $connbas->prepare($sql);
|
||||
$stmt->execute([
|
||||
':dces_element' => $DCES_element->get_label()
|
||||
]);
|
||||
$stmt->closeCursor();
|
||||
$connection->executeUpdate(
|
||||
'UPDATE metadatas_structure SET dces_element = null WHERE dces_element = :dces_element',
|
||||
[
|
||||
'dces_element' => $DCES_element->get_label(),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
$sql = 'UPDATE metadatas_structure
|
||||
SET dces_element = :dces_element WHERE id = :id';
|
||||
$connection->executeUpdate(
|
||||
'UPDATE metadatas_structure SET dces_element = :dces_element WHERE id = :id',
|
||||
[
|
||||
'dces_element' => $DCES_element ? $DCES_element->get_label() : null,
|
||||
'id' => $this->id,
|
||||
]
|
||||
);
|
||||
|
||||
$stmt = $connbas->prepare($sql);
|
||||
$stmt->execute([
|
||||
':dces_element' => $DCES_element ? $DCES_element->get_label() : null
|
||||
, ':id' => $this->id
|
||||
]);
|
||||
$stmt->closeCursor();
|
||||
$this->dces_element = $DCES_element;
|
||||
|
||||
$this->delete_data_from_cache();
|
||||
@@ -934,12 +942,12 @@ class databox_field implements cache_cacheableInterface
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function __sleep()
|
||||
{
|
||||
$vars = [];
|
||||
|
||||
foreach ($this as $key => $value) {
|
||||
if (in_array($key, ['databox', 'app', 'Vocabulary']))
|
||||
continue;
|
||||
@@ -997,10 +1005,14 @@ class databox_field implements cache_cacheableInterface
|
||||
|
||||
private function loadVocabulary()
|
||||
{
|
||||
try {
|
||||
$this->Vocabulary = Vocabulary\Controller::get($this->app, $this->VocabularyType);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
if ($this->VocabularyType === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$this->Vocabulary = $this->app['vocabularies'][$this->VocabularyType];
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
// Could not find Vocabulary
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user