I am developing a simple ERP solution and have hit a roadbump... I have 2 models, one for products and one for Stock levels. The idea is that saving the product also saves the stock level. However, although when I create the product the stock level is saved correctly into the Stock table, when I try to edit a product, the field that should display the stock level comes up empty, although a value does exist.
This is the init for stock levels for the Products model:
$this->hasOne('id', __NAMESPACE__ . '\ProductStock', 'product_id', array( 'alias' => 'ProductStock' ));
and this is the init for products for the Sotck model:
$this->hasOne('product_id', _NAMESPACE_ . '\Products', 'id', array( 'alias' => 'Products' ));
They should have a 1-1 relationship between them. I know I am doing something wrong, I am just not sure what it is...
Thanks your your help...