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