public function Transaction::setTargetEntity in Transaction 8
Sets the transaction's target entity.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity: The target content entity.
Return value
\Drupal\transaction\TransactionInterface The called transaction entity.
Throws
\InvalidArgumentException If the type of the given entity is not valid for the transaction type.
Overrides TransactionInterface::setTargetEntity
File
- src/
Entity/ Transaction.php, line 499
Class
- Transaction
- Provides the transaction content entity.
Namespace
Drupal\transaction\EntityCode
public function setTargetEntity(ContentEntityInterface $entity) {
$this
->get('target_entity')
->setValue($entity);
return $this;
}