Hey all,
I'm having an issue after updating October to some more recent builds. I get this error on two separate installations across two different plugins. The installations are at build 306 and build 309. The issue is that when trying to reference a component's relationship with an object (hasOne/hasMany/belongsTo etc.), it is being returned null. This used to work on earlier builds, I'm not sure which build broke it.
The following is an example of the code:
function onEnd()
{
// Use product information for SEO.
$this->page->title = $this->page->components['shopProduct']->product->title . ' | My Website';
$this->page->canonical_url = 'https://mywebsite.com/merch/product/' . $this->page->components['shopProduct']->product->slug;
}
The goal here is to inject the name of a product into the page's meta title and so on. However, $this->page->components['shopProduct']->product now returns null, so the above code throws a "Trying to get property of non-object" error.
Any information or possible workarounds on this would be greatly appreciated. I can provide any additional information if needed as well. Thanks!
Last updated