Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / media / src / MediaStorage.php
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 }