Jump to content

$page->created in hookevent? very strange...


bernhard
 Share

Recommended Posts

hi,

i had a really strange bug today!

szenario:

user can book an event

user gets invoice via mail

admin can create new invoices

the problem:

$page->created was empty on mail-invoices whereas it was properly filled on admin-creation

difference between those two events from the code-perspective: nothing :( both are triggered via $page->createInvoice();

    public function renderAddressSection($event) {
        $page = $event->object;
        $eventpage = $page->getEventPage();

        if($page->template != "booking") return;

        // shows 0
        $page->created;

        // shows 1462893271
        wire('pages')->get($page->id)->created;

any ideas what could cause this odd behaviour?? all other fields work well. of course in both cases the booking is already saved. that was my first guess, but in both cases there was a proper id for the page...

a quick test if "created" was not available in hooks in general showed, that it SHOULD work as i expected:

    $this->addHookProperty('Page::test', $this, 'test');

    public function test($event) {
        $page = $event->object;
        $event->return = $page->created;
    }

$page = $pages->get(3505);
$page->of(false);
echo $page->created . ' ' . $page->test;
// shows 1462893271 1462893271

thank you for your help!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...