Mercurial > hg > isophonics-drupal-site
annotate core/lib/Drupal/Core/Entity/EntityChangedInterface.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | af1871eacc83 |
children |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 |
Chris@0 | 3 namespace Drupal\Core\Entity; |
Chris@0 | 4 |
Chris@0 | 5 /** |
Chris@0 | 6 * Defines an interface for entity change timestamp tracking. |
Chris@0 | 7 * |
Chris@0 | 8 * This data may be useful for more precise cache invalidation (especially |
Chris@0 | 9 * on the client side) and concurrent editing locking. |
Chris@0 | 10 * |
Chris@0 | 11 * The entity system automatically adds in the 'EntityChanged' constraint for |
Chris@0 | 12 * entity types implementing this interface in order to disallow concurrent |
Chris@0 | 13 * editing. |
Chris@0 | 14 * |
Chris@18 | 15 * @see \Drupal\Core\Entity\Plugin\Validation\Constraint\EntityChangedConstraint |
Chris@0 | 16 */ |
Chris@18 | 17 interface EntityChangedInterface extends EntityInterface { |
Chris@0 | 18 |
Chris@0 | 19 /** |
Chris@0 | 20 * Gets the timestamp of the last entity change for the current translation. |
Chris@0 | 21 * |
Chris@0 | 22 * @return int |
Chris@0 | 23 * The timestamp of the last entity save operation. |
Chris@0 | 24 */ |
Chris@0 | 25 public function getChangedTime(); |
Chris@0 | 26 |
Chris@0 | 27 /** |
Chris@0 | 28 * Sets the timestamp of the last entity change for the current translation. |
Chris@0 | 29 * |
Chris@0 | 30 * @param int $timestamp |
Chris@0 | 31 * The timestamp of the last entity save operation. |
Chris@0 | 32 * |
Chris@0 | 33 * @return $this |
Chris@0 | 34 */ |
Chris@0 | 35 public function setChangedTime($timestamp); |
Chris@0 | 36 |
Chris@0 | 37 /** |
Chris@0 | 38 * Gets the timestamp of the last entity change across all translations. |
Chris@0 | 39 * |
Chris@12 | 40 * This method will return the highest timestamp across all translations. To |
Chris@12 | 41 * check that no translation is older than in another version of the entity |
Chris@12 | 42 * (e.g. to avoid overwriting newer translations with old data), compare each |
Chris@12 | 43 * translation to the other version individually. |
Chris@12 | 44 * |
Chris@0 | 45 * @return int |
Chris@0 | 46 * The timestamp of the last entity save operation across all |
Chris@0 | 47 * translations. |
Chris@0 | 48 */ |
Chris@0 | 49 public function getChangedTimeAcrossTranslations(); |
Chris@0 | 50 |
Chris@0 | 51 } |