Merge branch 'develop' of https://github.com/tainacan/tainacan into develop

This commit is contained in:
mateuswetah 2020-04-23 22:21:04 -03:00
commit 3d05e7348a
1 changed files with 14 additions and 1 deletions

View File

@ -83,7 +83,20 @@ class Compound extends Metadata_Type {
if( $metadatum_type_object instanceof \Tainacan\Metadata_Types\Compound ) {
$options = $metadatum->get_metadata_type_options();
if( isset( $options['parent'] ) ) {
$Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance();
$childrens = $Tainacan_Metadata->fetch( ['parent' => $options['parent'] ], "OBJECT" );
foreach ($childrens as $child) {
if ($child->get_status() != $metadatum->get_status()) {
$child->set_status( $metadatum->get_status() );
if( $child->validate() ) {
$Tainacan_Metadata->update( $child );
}
}
}
}
if( isset( $options['parent'] ) )
return;