1

Controller file

$collection = $this->investmentFactory->create()->load($id);
        $collection->getData();

        // echo '<pre/>';
        // print_r($collection->getData());
        $this->eventManager->dispatch('trigger_order_place',['collection', $collection]);
        exit;

In this observer file data is null

$collection = $observer->getEvent()->getCollection();
        var_dump($collection);
        

1 Answer 1

3

I think the problem is that you must pass key => value and you pass like two array items. Here is from core code.

        $this->eventManager->dispatch(
            'sales_order_payment_capture',
            ['payment' => $payment, 'invoice' => $invoice]
        );

Try changing to

$this->eventManager->dispatch('trigger_order_place',['collection' => $collection]);

1
  • 1
    I agree with this.
    – Diana
    Mar 30, 2021 at 12:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.