Not sure if I'm doing something wrong here but here goes..
I have 2 models, Products
and ProductsPages
that contain relations in the initialize()
method in each file respectively:
$this->hasMany('id', 'Pkg\Lib\Core\Products\Models\ProductsPages', 'product_id');
$this->belongsTo('product_id', 'Pkg\Lib\Core\Products\Models\Products', 'id');
However upon calling $product->getProductPages();
the following exception is thrown:
The method "getProductsPages" doesn't exist on model "Pkg\Lib\Core\Products\Models\Products"
$product = Products::findFirst($productId); // correctly returns object of Pkg\Lib\Core\Products\Models\Products
$pages = $product->getProductsPages(); // throws exception