Express Entry in Hook/Event not available

Permalink
As described inhttps://documentation.concrete5.org/developers/application-events/ho... I tried to hook into event on_express_entry_saved in file application/bootstrap/app.php. But I've got the same problem as "agencecoteo" (first comment/message).
Though I have access to the ID of the entry, I'm not able to call the other properties by their magic methods (e.g. $entry->getNom() ).

The main problem is, I cannot load the whole Express entry: $express = \Express::getEntry($entry->getId());

How can I access all of the properties?

kfidel
 
typoman76 replied on at Permalink Reply
typoman76
Hi anyone? I'm interested in this too.

------------------------------------------------------------------------------------
Original question from documentation that kfidel mentioned is:
------------------------------------------------------------------------------------

Hi, i'm not able to load Express Object Attributes Value either form the Package Controller nor from a call to a class method in packages/package_name/src/test.php directory. In my Package Controller on_start method i have add :
Events::addListener('on_express_entry_saved', function($event) {
$entry = $event->getEntry();
\Log::info(sprintf('Name of the entry is', $entry->getNom() ));
});

The Entry object is correctly loaded but impossible to get the Attribute Value by its Handle with the getAttributeHandle() function. However i'm able to call the Entry Obect ID with $entry->getID(). The getNom() method work from another Pages Controllers.
TimDix replied on at Permalink Reply
TimDix
Just ran into this myself, the solution I came up with is to use the Express::refresh() method, and then attributes / associations work.

Events::addListener('on_express_entry_saved', function($event) {
    $entry = \Express::refresh($event->getEntry());
    dd($entry->getProductName());
});


Appears to be same as this bug report:
https://www.concrete5.org/developers/bugs/8-1-0/cant-getattributes-o...
TimDix replied on at Permalink Reply
TimDix
Just ran into this myself, the solution I came up with is to use the Express::refresh() method, and then attributes / associations work.

Events::addListener('on_express_entry_saved', function($event) {
    $entry = \Express::refresh($event->getEntry());
    dd($entry->getProductName());
});


Appears to be same as this bug report:
https://www.concrete5.org/developers/bugs/8-1-0/cant-getattributes-o...