Classes, traits, and interfaces - 8.9.x - drupal

Primary tabs

Introduction to classes

A lot of the PHP code in Drupal is object oriented (OO), making use of PHP classes, interfaces, and traits. See the Objected-oriented programming conventions for more information.

See also

Objected-oriented programming conventions

File

core/core.api.php, line 1511

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
EntityResourceAccessTrait trait Drupal\rest\Plugin\rest\resource core/modules/rest/src/Plugin/rest/resource/EntityResourceAccessTrait.php @internal @todo Consider making public in https://www.drupal.org/node/2300677 1
EntityResourcePermissionsUpdateTest class Drupal\Tests\rest\Functional\Update core/modules/rest/tests/src/Functional/Update/EntityResourcePermissionsUpdateTest.php Tests that existing sites continue to use permissions for EntityResource.
EntityResourcePostRouteSubscriber class Drupal\rest\EventSubscriber core/modules/rest/src/EventSubscriber/EntityResourcePostRouteSubscriber.php Generates a 'create' route for an entity type if it has a REST POST route. 2
EntityResourceRestTestCoverageTest class Drupal\Tests\rest\Functional\EntityResource core/modules/rest/tests/src/Functional/EntityResource/EntityResourceRestTestCoverageTest.php Checks that all core content/config entity types have REST test coverage.
EntityResourceTest class Drupal\Tests\jsonapi\Kernel\Controller core/modules/jsonapi/tests/src/Kernel/Controller/EntityResourceTest.php @coversDefaultClass \Drupal\jsonapi\Controller\EntityResource @group jsonapi
EntityResourceTestBase abstract class Drupal\Tests\rest\Functional\EntityResource core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php Even though there is the generic EntityResource, it's necessary for every entity type to have its own test, because they each have different fields, validation constraints, et cetera. It's not because the generic case works, that every case… 50 50
EntityResourceValidationTrait trait Drupal\rest\Plugin\rest\resource core/modules/rest/src/Plugin/rest/resource/EntityResourceValidationTrait.php @internal @todo Consider making public in https://www.drupal.org/node/2300677 3
EntityResourceValidationTraitTest class Drupal\Tests\rest\Unit core/modules/rest/tests/src/Unit/EntityResourceValidationTraitTest.php @group rest @coversDefaultClass \Drupal\rest\Plugin\rest\resource\EntityResourceValidationTrait
EntityResourceValidationTraitTestClass class Drupal\Tests\rest\Unit core/modules/rest/tests/src/Unit/EntityResourceValidationTraitTest.php A test class to use to test EntityResourceValidationTrait.
EntityReverse class Drupal\views\Plugin\views\relationship core/modules/views/src/Plugin/views/relationship/EntityReverse.php A relationship handlers which reverse entity references.
EntityRevision class Drupal\migrate\Plugin\migrate\destination core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php Provides entity revision destination plugin. 2 2
EntityRevision class Drupal\Tests\migrate\Unit\destination core/modules/migrate/tests/src/Unit/destination/EntityRevisionTest.php Mock that exposes from internal methods for testing.
EntityRevisionConverter class Drupal\content_moderation\ParamConverter core/modules/content_moderation/src/ParamConverter/EntityRevisionConverter.php Defines a class for making sure the edit-route loads the current draft. 2
EntityRevisionConverterTest class Drupal\Tests\content_moderation\Kernel core/modules/content_moderation/tests/src/Kernel/EntityRevisionConverterTest.php @coversDefaultClass \Drupal\content_moderation\ParamConverter\EntityRevisionConverter @group content_moderation @group legacy
EntityRevisionParamConverter class Drupal\Core\ParamConverter core/lib/Drupal/Core/ParamConverter/EntityRevisionParamConverter.php Parameter converter for upcasting entity revision IDs to full objects. 1 2
EntityRevisionParamConverterTest class Drupal\Tests\Core\ParamConverter core/tests/Drupal/Tests/Core/ParamConverter/EntityRevisionParamConverterTest.php @coversDefaultClass \Drupal\Core\ParamConverter\EntityRevisionParamConverter @group entity
EntityRevisionRouteEnhancer class Drupal\Core\Routing\Enhancer core/lib/Drupal/Core/Routing/Enhancer/EntityRevisionRouteEnhancer.php Adds _entity_revision to the request attributes, if possible. 1 2
EntityRevisionRouteEnhancerTest class Drupal\Tests\Core\Enhancer core/tests/Drupal/Tests/Core/Enhancer/EntityRevisionRouteEnhancerTest.php @coversDefaultClass \Drupal\Core\Routing\Enhancer\EntityRevisionRouteEnhancer @group Entity
EntityRevisionsTest class Drupal\KernelTests\Core\Entity core/tests/Drupal/KernelTests/Core/Entity/EntityRevisionsTest.php Tests the loaded Revision of an entity.
EntityRevisionsTest class Drupal\Tests\system\Functional\Entity core/modules/system/tests/src/Functional/Entity/EntityRevisionsTest.php Create a entity with revisions and test viewing, saving, reverting, and deleting revisions.
EntityRevisionTest class Drupal\Tests\migrate\Unit\destination core/modules/migrate/tests/src/Unit/destination/EntityRevisionTest.php Tests entity revision destination.
EntityRevisionTest class Drupal\Tests\migrate\Unit\Plugin\migrate\destination core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityRevisionTest.php Tests entity revision destination functionality.
EntityRevisionTest class Drupal\Tests\migrate\Kernel\Plugin core/modules/migrate/tests/src/Kernel/Plugin/EntityRevisionTest.php Tests the EntityRevision destination plugin.
EntityRevisionTestDestination class Drupal\Tests\migrate\Unit\Plugin\migrate\destination core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityRevisionTest.php Stub class for testing EntityRevision methods.
EntityRevisionTranslationTest class Drupal\KernelTests\Core\Entity core/tests/Drupal/KernelTests/Core/Entity/EntityRevisionTranslationTest.php Tests proper revision propagation of entities.
EntityRouteAlterSubscriber class Drupal\Core\EventSubscriber core/lib/Drupal/Core/EventSubscriber/EntityRouteAlterSubscriber.php Registers the 'type' of route parameter names that match an entity type. 2
EntityRouteEnhancer class Drupal\Core\Entity\Enhancer core/lib/Drupal/Core/Entity/Enhancer/EntityRouteEnhancer.php Enhances an entity form route with the appropriate controller. 1 2
EntityRouteEnhancerTest class Drupal\Tests\Core\Entity\Enhancer core/tests/Drupal/Tests/Core/Entity/Enhancer/EntityRouteEnhancerTest.php @coversDefaultClass \Drupal\Core\Entity\Enhancer\EntityRouteEnhancer @group Entity
EntityRouteProviderInterface interface Drupal\Core\Entity\Routing core/lib/Drupal/Core/Entity/Routing/EntityRouteProviderInterface.php Allows entity types to provide routes. 4 3
EntityRouteProviderSubscriber class Drupal\Core\EventSubscriber core/lib/Drupal/Core/EventSubscriber/EntityRouteProviderSubscriber.php Ensures that routes can be provided by entity types. 2
EntityRow class Drupal\views\Plugin\views\row core/modules/views/src/Plugin/views/row/EntityRow.php Generic entity row plugin to provide a common base for all entity types. 2 2
EntitySavedCommand class Drupal\quickedit\Ajax core/modules/quickedit/src/Ajax/EntitySavedCommand.php AJAX command to indicate the entity was loaded from PrivateTempStore and saved into the database. 1
EntitySchemaSubscriber class Drupal\entity_test_update\EventSubscriber core/modules/system/tests/modules/entity_test_update/src/EventSubscriber/EntitySchemaSubscriber.php Defines a class for listening to entity schema changes. 2
EntitySchemaSubscriber class Drupal\workspaces\EventSubscriber core/modules/workspaces/src/EventSubscriber/EntitySchemaSubscriber.php Defines a class for listening to entity schema changes. 2
EntitySchemaTest class Drupal\KernelTests\Core\Entity core/tests/Drupal/KernelTests/Core/Entity/EntitySchemaTest.php Tests the default entity storage schema handler.
EntitySearchPage class Drupal\search\Plugin\migrate\destination core/modules/search/src/Plugin/migrate/destination/EntitySearchPage.php Migrate destination for search page.
EntitySerializationTest class Drupal\Tests\serialization\Kernel core/modules/serialization/tests/src/Kernel/EntitySerializationTest.php Tests that entities can be serialized to supported core formats.
EntitySerializedField class Drupal\entity_test\Entity core/modules/system/tests/modules/entity_test/src/Entity/EntitySerializedField.php Defines a test class for testing fields with a serialized column. 2
EntityShortcutSet class Drupal\shortcut\Plugin\migrate\destination core/modules/shortcut/src/Plugin/migrate/destination/EntityShortcutSet.php Plugin annotation @MigrateDestination( id = "entity:shortcut_set" )
EntityStateChangeValidationTest class Drupal\Tests\content_moderation\Kernel core/modules/content_moderation/tests/src/Kernel/EntityStateChangeValidationTest.php @coversDefaultClass \Drupal\content_moderation\Plugin\Validation\Constraint\ModerationStateConstraintValidator @group content_moderation
EntityStorageBase abstract class Drupal\Core\Entity core/lib/Drupal/Core/Entity/EntityStorageBase.php A base entity storage class. 3 2
EntityStorageException class Drupal\Core\Entity core/lib/Drupal/Core/Entity/EntityStorageException.php Defines an exception thrown when storage operations fail. 2 26
EntityStorageInterface interface Drupal\Core\Entity core/lib/Drupal/Core/Entity/EntityStorageInterface.php Defines the interface for entity storage classes. 7 141
EntityStorageSchemaInterface interface Drupal\Core\Entity\Schema core/lib/Drupal/Core/Entity/Schema/EntityStorageSchemaInterface.php Defines the interface for entity storage schema handler classes. 1 1
EntityTest class Drupal\Tests\views\Unit\Plugin\argument_validator core/modules/views/tests/src/Unit/Plugin/argument_validator/EntityTest.php @coversDefaultClass \Drupal\views\Plugin\views\argument_validator\Entity @group views
EntityTest class Drupal\Tests\views\Unit\Plugin\area core/modules/views/tests/src/Unit/Plugin/area/EntityTest.php @coversDefaultClass \Drupal\views\Plugin\views\area\Entity @group Entity
EntityTest class Drupal\entity_test\Entity core/modules/system/tests/modules/entity_test/src/Entity/EntityTest.php Defines the test entity class. 30 152
EntityTestAccessControlHandler class Drupal\entity_test core/modules/system/tests/modules/entity_test/src/EntityTestAccessControlHandler.php Defines the access control handler for the test entity type.
EntityTestAdminRoutes class Drupal\entity_test\Entity core/modules/system/tests/modules/entity_test/src/Entity/EntityTestAdminRoutes.php Defines a test entity type with administrative routes. 1
EntityTestBase class Drupal\Tests\migrate\Unit\Plugin\migrate\destination core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityTestBase.php Base test class forentity migration destination functionality. 2

Other projects


Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.