Skip to content
Snippets Groups Projects
Commit 6e416ae6 authored by Yas Naoi's avatar Yas Naoi Committed by Yas Naoi
Browse files

Issue #3220242 by yas, baldwinlouie: Change the signature of CloudEntityEvent constructor

parent d2003d73
No related branches found
No related tags found
No related merge requests found
......@@ -1580,7 +1580,7 @@ function aws_cloud_form_cloud_server_template_aws_cloud_edit_form_submit(array $
}
if ($success && $server_template->save()) {
aws_cloud_dispatch_event(new CloudEntityEvent(CloudEntityEventType::FORM_SUBMIT, $server_template));
aws_cloud_dispatch_event(new CloudEntityEvent($server_template, CloudEntityEventType::FORM_SUBMIT));
\Drupal::service('cloud')->processOperationStatus($server_template, 'updated');
$form_state->setRedirect(
......@@ -1629,7 +1629,7 @@ function aws_cloud_form_cloud_server_template_aws_cloud_add_form_submit(array $f
if ($success && $server_template->save()
) {
aws_cloud_dispatch_event(new CloudEntityEvent(CloudEntityEventType::FORM_SUBMIT, $server_template));
aws_cloud_dispatch_event(new CloudEntityEvent($server_template, CloudEntityEventType::FORM_SUBMIT));
\Drupal::service('cloud')->processOperationStatus($server_template, 'created');
......@@ -1685,7 +1685,7 @@ function aws_cloud_form_cloud_server_template_aws_cloud_launch_form_submit(array
$params['DefaultVersion'] = $version;
$ec2_service->modifyLaunchTemplate($params);
aws_cloud_dispatch_event(new CloudEntityEvent(CloudEntityEventType::TEMPLATE_LAUNCH, $server_template));
aws_cloud_dispatch_event(new CloudEntityEvent($server_template, CloudEntityEventType::TEMPLATE_LAUNCH));
}
......@@ -2287,7 +2287,7 @@ function aws_cloud_form_cloud_server_template_aws_cloud_delete_form_submit(array
try {
$server_template->delete();
aws_cloud_dispatch_event(new CloudEntityEvent(CloudEntityEventType::LAUNCH_TEMPLATE_DELETE, $server_template));
aws_cloud_dispatch_event(new CloudEntityEvent($server_template, CloudEntityEventType::LAUNCH_TEMPLATE_DELETE));
\Drupal::service('cloud')->processOperationStatus($server_template, 'deleted');
}
catch (\Exception $e) {
......
......@@ -27,12 +27,12 @@ class CloudEntityEvent extends Event {
/**
* Construct a new entity event.
*
* @param string $event_type
* The event type.
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity which caused the event.
* @param string $event_type
* The event type.
*/
public function __construct($event_type, EntityInterface $entity) {
public function __construct(EntityInterface $entity, string $event_type) {
$this->entity = $entity;
$this->eventType = $event_type;
}
......
......@@ -580,7 +580,7 @@ trait CloudContentEntityTrait {
* Event object.
*/
private function dispatchEvent(EntityInterface $entity, string $event_type): CloudEntityEvent {
$event = new CloudEntityEvent($event_type, $entity);
$event = new CloudEntityEvent($entity, $event_type);
\Drupal::service('event_dispatcher')->dispatch($event, $event_type);
return $event;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment