@@ -784,7 +784,8 @@ public function fixmetadataAction()
784
784
set_time_limit (0 );
785
785
786
786
// Check for problems:
787
- $ problems = $ this ->getDbService (ResourceServiceInterface::class)->findMissingMetadata ();
787
+ $ resourceService = $ this ->getDbService (ResourceServiceInterface::class);
788
+ $ problems = $ resourceService ->findMissingMetadata ();
788
789
789
790
// No problems? We're done here!
790
791
if (count ($ problems ) == 0 ) {
@@ -794,18 +795,22 @@ public function fixmetadataAction()
794
795
795
796
// Process submit button:
796
797
if ($ this ->formWasSubmitted ()) {
797
- $ resourceService = $ this ->getDbService (ResourceServiceInterface::class);
798
798
$ resourcePopulator = $ this ->serviceLocator ->get (ResourcePopulator::class);
799
799
foreach ($ problems as $ problem ) {
800
+ $ recordId = $ problem ->getRecordId ();
801
+ $ source = $ problem ->getSource ();
800
802
try {
801
- $ driver = $ this ->getRecordLoader ()->load ($ problem -> getRecordId () , $ problem -> getSource () );
803
+ $ driver = $ this ->getRecordLoader ()->load ($ recordId , $ source );
802
804
$ resourceService ->persistEntity (
803
805
$ resourcePopulator ->assignMetadata ($ problem , $ driver )
804
806
);
805
807
} catch (RecordMissingException $ e ) {
806
808
$ this ->session ->warnings ->append (
807
- 'Unable to load metadata for record '
808
- . "{$ problem ->getSource ()}: {$ problem ->getRecordId ()}"
809
+ "Unable to load metadata for record {$ source }: {$ recordId }"
810
+ );
811
+ } catch (\Exception $ e ) {
812
+ $ this ->session ->warnings ->append (
813
+ "Problem saving metadata updates for record {$ source }: {$ recordId }"
809
814
);
810
815
}
811
816
}
0 commit comments