protected function ConditionBase::assertEntity in Commerce Core 8.2
Asserts that the given entity is of the expected type.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity.
20 calls to ConditionBase::assertEntity()
- EntityBundleBase::evaluate in src/
Plugin/ Commerce/ Condition/ EntityBundleBase.php - Evaluates the condition.
- OrderBillingAddress::evaluate in modules/
order/ src/ Plugin/ Commerce/ Condition/ OrderBillingAddress.php - Evaluates the condition.
- OrderCurrency::evaluate in modules/
order/ src/ Plugin/ Commerce/ Condition/ OrderCurrency.php - Evaluates the condition.
- OrderCustomer::evaluate in modules/
order/ src/ Plugin/ Commerce/ Condition/ OrderCustomer.php - Evaluates the condition.
- OrderCustomerRole::evaluate in modules/
order/ src/ Plugin/ Commerce/ Condition/ OrderCustomerRole.php - Evaluates the condition.
File
- src/
Plugin/ Commerce/ Condition/ ConditionBase.php, line 99
Class
- ConditionBase
- Provides the base class for conditions.
Namespace
Drupal\commerce\Plugin\Commerce\ConditionCode
protected function assertEntity(EntityInterface $entity) {
$entity_type_id = $entity
->getEntityTypeId();
$condition_entity_type_id = $this
->getEntityTypeId();
if ($entity_type_id != $condition_entity_type_id) {
throw new \InvalidArgumentException(sprintf('The condition requires a "%s" entity, but a "%s" entity was given.', $condition_entity_type_id, $entity_type_id));
}
}