Martijn you can actually do PDO::FETCH_CLASS|PDO::FETCH_PROPS_LATE to fill in properties *after* __construct!
Mark Dain Oh nice! Although for your usecase of loading into the Item class, you still need to convert to DateTimeImmutable, right? Nice to know though!
7y, 26w 1 reply
Martijn Yes. But I am wondering if conversion on first access (first $instance->created() call) would be an option. Same for the item contents, instead of always reading the flatfile into memory on __construct only do it at first access ($instance->content()).
7y, 26w reply
Login or register your account to reply