mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 23:13:15 +00:00
Restore merge exceptions and add structure factory method
This commit is contained in:
@@ -46,7 +46,7 @@ final class GlobalStructure implements Structure
|
||||
|
||||
/**
|
||||
* @param \databox[] $databoxes
|
||||
* @return self
|
||||
* @return GlobalStructure
|
||||
*/
|
||||
public static function createFromDataboxes(array $databoxes)
|
||||
{
|
||||
@@ -66,6 +66,26 @@ final class GlobalStructure implements Structure
|
||||
return new self($fields, $flags, MetadataHelper::createTags());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \databox $databox
|
||||
* @return GlobalStructure
|
||||
*/
|
||||
public static function createFromDatabox(\databox $databox)
|
||||
{
|
||||
$fields = [];
|
||||
$flags = [];
|
||||
|
||||
foreach ($databox->get_meta_structure() as $fieldStructure) {
|
||||
$fields[] = Field::createFromLegacyField($fieldStructure);
|
||||
}
|
||||
|
||||
foreach ($databox->getStatusStructure() as $status) {
|
||||
$flags[] = Flag::createFromLegacyStatus($status);
|
||||
}
|
||||
|
||||
return new self($fields, $flags, MetadataHelper::createTags());
|
||||
}
|
||||
|
||||
/**
|
||||
* GlobalStructure constructor.
|
||||
* @param Field[] $fields
|
||||
|
Reference in New Issue
Block a user