protected function Registration::createStubs in RNG - Events and Registrations 8.2
Same name and namespace in other branches
- 3.x src/Entity/Registration.php \Drupal\rng\Entity\Registration::createStubs()
2 calls to Registration::createStubs()
- Registration::getRegistrants in src/
Entity/ Registration.php - Get registrants for the registration.
- Registration::postSave in src/
Entity/ Registration.php - Acts on a saved entity before the insert or update hook is invoked.
File
- src/
Entity/ Registration.php, line 436
Class
- Registration
- Defines the registration entity class.
Namespace
Drupal\rng\EntityCode
protected function createStubs() {
$stub_count = $this
->getRegistrantQty();
if ($stub_count && $this
->canAddRegistrants()) {
/** @var \Drupal\rng\RegistrantFactoryInterface $registrant_factory */
$registrant_factory = \Drupal::service('rng.registrant.factory');
$registrant_count = count($this
->getRegistrantIds());
$stub_count -= $registrant_count;
while ($stub_count) {
$registrant = $registrant_factory
->createRegistrant([
'event' => $this
->getEvent(),
]);
$registrant
->setRegistration($this)
->save();
$stub_count--;
}
}
}