Mercurial > hg > isophonics-drupal-site
comparison core/modules/media/src/MediaStorage.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\media; | |
4 | |
5 use Drupal\Core\Entity\EntityInterface; | |
6 use Drupal\Core\Entity\Sql\SqlContentEntityStorage; | |
7 | |
8 /** | |
9 * Defines the storage handler class for media. | |
10 * | |
11 * The default storage is overridden to handle metadata fetching outside of the | |
12 * database transaction. | |
13 */ | |
14 class MediaStorage extends SqlContentEntityStorage { | |
15 | |
16 /** | |
17 * {@inheritdoc} | |
18 */ | |
19 public function save(EntityInterface $media) { | |
20 // For backwards compatibility, modules that override the Media entity | |
21 // class, are not required to implement the prepareSave() method. | |
22 // @todo For Drupal 8.7, consider throwing a deprecation notice if the | |
23 // method doesn't exist. See | |
24 // https://www.drupal.org/project/drupal/issues/2992426 for further | |
25 // discussion. | |
26 if (method_exists($media, 'prepareSave')) { | |
27 $media->prepareSave(); | |
28 } | |
29 return parent::save($media); | |
30 } | |
31 | |
32 } |