annotate core/modules/media/src/MediaStorage.php @ 5:12f9dff5fda9 tip

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