public function Subscription::postCreate in Mailing List 8
Acts on a created entity before hooks are invoked.
Used after the entity is created, but before saving the entity and before any of the presave hooks are invoked.
See the Entity CRUD topic for more information.
Parameters
\Drupal\Core\Entity\EntityStorageInterface $storage: The entity storage object.
Overrides ContentEntityBase::postCreate
See also
\Drupal\Core\Entity\EntityInterface::create()
File
- src/
Entity/ Subscription.php, line 449
Class
- Subscription
- Defines the subscription entity class.
Namespace
Drupal\mailing_list\EntityCode
public function postCreate(EntityStorageInterface $storage) {
parent::postCreate($storage);
// Grant session access to anonymous.
if ($this
->getOwner()
->isAnonymous() && \Drupal::currentUser()
->isAnonymous()) {
\Drupal::service('mailing_list.manager')
->grantSessionAccess($this);
}
}