PHRAS-2815_generate-cterms-multi-db_4.1

fix : the "generate cterms" setting is applied by db
how : the "global_structure" (fields merged) now also contains field settings by db
This commit is contained in:
Jean-Yves Gaulier
2019-11-07 17:24:57 +01:00
parent 56c9a033bc
commit cba5f8a1a2
3 changed files with 37 additions and 5 deletions

View File

@@ -14,6 +14,12 @@ final class GlobalStructure implements Structure
*/
private $fields = array();
/**
* @var Field[][]
*/
private $fieldsByDatabox = [];
/**
* @var Field[]
* */
@@ -119,6 +125,10 @@ final class GlobalStructure implements Structure
public function add(Field $field)
{
// store info for each field, not still merged by databox
$this->fieldsByDatabox[$field->get_databox_id()][$field->getName()] = $field;
// store merged infos (same field name)
$name = $field->getName();
if (isset($this->fields[$name])) {
@@ -152,6 +162,11 @@ final class GlobalStructure implements Structure
return $this->fields;
}
public function getAllFieldsByDatabox($databox_id)
{
return $this->fieldsByDatabox[$databox_id];
}
/**
* @return Field[]
*/