EntityTestBundleClass.php in Drupal 10
File
core/modules/system/tests/modules/entity_test_bundle_class/src/Entity/EntityTestBundleClass.php
View source
<?php
namespace Drupal\entity_test_bundle_class\Entity;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\entity_test\Entity\EntityTest;
class EntityTestBundleClass extends EntityTest {
public static $preCreateCount = 0;
public $postCreateCount = 0;
public static $preDeleteCount = 0;
public static $postDeleteCount = 0;
public static $postLoadCount = 0;
public static $postLoadEntitiesCount = [];
public static function preCreate(EntityStorageInterface $storage, array &$values) {
parent::preCreate($storage, $values);
self::$preCreateCount++;
}
public function postCreate(EntityStorageInterface $storage) {
parent::postCreate($storage);
$this->postCreateCount++;
}
public static function preDelete(EntityStorageInterface $storage, array $entities) {
parent::preDelete($storage, $entities);
self::$preDeleteCount++;
}
public static function postDelete(EntityStorageInterface $storage, array $entities) {
parent::postDelete($storage, $entities);
self::$postDeleteCount++;
}
public static function postLoad(EntityStorageInterface $storage, array &$entities) {
parent::postLoad($storage, $entities);
self::$postLoadCount++;
self::$postLoadEntitiesCount[] = count($entities);
}
}