Problem/Motivation
I would expect to be able to do this:
$variation = ProductVariation::load($vid);
$variation->get('field_registration_types')->createHostEntity();
But I can't, there's no way of getting the host entity directly from the underlying entity.
I have to remember to go the long way around:
$handler = $this->entityTypeManager->getHandler('registration', 'host_entity');
$handler->createHostEntity($variation);
Proposed resolution
Add a createHostEntity() convenience method to RegistrationItemFieldItemlList.
User interface changes
None.
API changes
Method added to RegistrationItemFieldItemlList
Data model changes
None
Comments
Comment #2
john.oltman commentedGreat idea jonathan, were you thinking of providing a patch or is this something I should take.
Comment #4
john.oltman commentedComment #5
john.oltman commentedComment #6
jonathanshawNice
Comment #8
john.oltman commented