Set talk type for existing talks
This commit is contained in:
parent
239b2c071c
commit
c44990643e
4 changed files with 56 additions and 1 deletions
web/modules/custom/opd_talks
17
web/modules/custom/opd_talks/opd_talks.install
Normal file
17
web/modules/custom/opd_talks/opd_talks.install
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Drupal\opd_talks\Repository\TalkRepository;
|
||||
|
||||
/**
|
||||
* Set talk type for all existing talks.
|
||||
*/
|
||||
function opd_talks_update_8001(): void {
|
||||
$talkRepository = \Drupal::service(TalkRepository::class);
|
||||
|
||||
foreach ($talkRepository->getAll() as $talk) {
|
||||
$talk->set('field_type', 'talk');
|
||||
$talk->save();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue