Skip to content

Commit

Permalink
Merge branch 'master' of github.com:tainacan/tainacan-wiki
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuswetah committed Nov 25, 2024
2 parents d270cda + f10e363 commit b1a30b7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dev/internal-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,12 @@ So the Item Metadata Entity constructor gets two entities: an item and a metadat

```php
// Considering $item is an existing Item Entity an $metadatum an existing Field Entity
$itemMetadada = new \Tainacan\Entities\ItemMetadataEntity($item, $metadatum);
$itemMetadata = new \Tainacan\Entities\Item_Metadata_Entity($item, $metadatum);

$itemMetadata->set_value('Red');

if ($itemMetadata->validate()) {
$ItemMetadataRepo = \Tainacan\Repositories\ItemMetadata::get_instance();
$ItemMetadataRepo = \Tainacan\Repositories\Item_Metadata::get_instance();
$ItemMetadata = $ItemMetadataRepo->insert($ItemMetadata);
} else {
$errors = $ItemMetadata->get_errors();
Expand All @@ -210,9 +210,9 @@ TODO: document the validation chains

All validations validate the property with the validation declared in the get_map() method of the repository.

Validate item -> call ItemMetadata->validate() for each metadatum
Validate item -> call Item_Metadata->validate() for each metadatum

Validate ItemMetadata -> call $metadatumType->validate() for the Field type of the metadatum.
Validate Item_Metadata -> call $metadatumType->validate() for the Field type of the metadatum.

Validate Field -> call validate_options() of the Field type

Expand Down

0 comments on commit b1a30b7

Please sign in to comment.