Lines Matching defs:metadata

30  *   A tabular metadata should be created to get all {@link DatabasePageRow::getMetaRecord()}
43 * @var Metadata - the uid metadata
48 * @var mixed - the uid metadata value
90 public function set(Metadata $metadata)
92 if ($metadata instanceof MetadataTabular) {
94 $this->syncTabular($metadata);
98 throw new ExceptionRuntime("The metadata ($metadata) is not yet supported on set", self::CANONICAL);
102 public function get(Metadata $metadata, $default = null)
105 $resource = $metadata->getResource();
107 throw new ExceptionRuntime("The resource type ({$resource->getType()}) is not yet supported for the database metadata store", self::CANONICAL);
110 if ($metadata instanceof MetadataTabular) {
112 return $this->getDbTabularData($metadata);
124 return $database->getFromRow($metadata->getName());
132 private function syncTabular(MetadataTabular $metadata)
136 $uid = $metadata->getUidObject();
138 throw new ExceptionRuntimeInternal("The uid class should be defined for the metadata ($metadata)");
141 $sourceRows = $metadata->toStoreValue();
146 $targetRows = $this->getDbTabularData($metadata);
152 $this->deleteRow($targetRow, $metadata);
157 $this->addRow($sourceRow, $metadata);
165 * @param Metadata $metadata
168 private function addRow(array $row, Metadata $metadata): void
174 $resourceCombo = $metadata->getResource();
185 $tableName = $this->getTableName($metadata);
202 * @param Metadata $metadata
204 private function deleteRow(array $row, Metadata $metadata): void
206 $tableName = $this->getTableName($metadata);
207 $resourceIdAttribute = $metadata->getResource()->getUidObject()::getPersistentName();
208 $metadataIdAttribute = $metadata->getUidObject()::getPersistentName();
235 * @var Metadata $metadata
237 private function getDbTabularData(Metadata $metadata): array
248 $children = $metadata->getChildrenObject();
250 throw new ExceptionRuntimeInternal("The children of the tabular metadata ($metadata) should be set to synchronize into the database");
256 $tableName = $this->getTableName($metadata);
268 throw new ExceptionRuntimeInternal("An exception has occurred with the $tableName ({$metadata->getResource()}) selection query. Message: {$e->getMessage()}, Query: ($query", self::CANONICAL, 1, $e);
313 private function getTableName(Metadata $metadata): string
315 return $metadata->getResource()->getType() . "_" . $metadata::getPersistentName();