
| Current Path : /var/www/html/store/web/modules/contrib/commerce/src/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/store/web/modules/contrib/commerce/src/EntityOwnerTrait.php |
<?php
namespace Drupal\commerce;
use Drupal\user\Entity\User;
use Drupal\user\EntityOwnerTrait as CoreEntityOwnerTrait;
/**
* Provides a trait for Commerce entities that have an owner.
*/
trait EntityOwnerTrait {
use CoreEntityOwnerTrait;
/**
* {@inheritdoc}
*/
public function getOwner() {
$key = $this->getEntityType()->getKey('owner');
$owner = $this->get($key)->entity;
// Handle deleted customers.
if (!$owner) {
$owner = User::getAnonymousUser();
}
return $owner;
}
}