protected static $_table_name = 'glaze_formulas';
protected static $_properties = array(
'id',
'colour_id',
'date',
'best_spray_weight',
'description',
'notes',
'created_at',
'updated_at',
);
protected static $_views = array(
'glaze_formulas_tot_quantity' => array(
'columns' => array(
'tot_quantity'
),
),
);
Model_Formula::query()->use_view('glaze_formulas_tot_quantity')
->where('id',$id)->get_one();
SELECT `t0`.`id` AS `t0_c0`, (...) `t0`.`tot_quantity` AS `t0_c8`The object also has the tot_quantity field in the _custom_data array
FROM `glaze_formulas_tot_quantity` AS `t0` WHERE `t0`.`id` = 1
[_custom_data:protected] => ArraySo, I started looking at the ORM/Model::get method, and turns out it's trying to return the field from the _data array
(
[tot_quantity] => 4
)
$result = $this->_data[$property];while it should be returning it from the _custom_data array
$result = $this->_custom_data[$property];After that change, the field is returned correctly.
$query = Glazes\Model_Colour::query()
->related('formulas')
->use_view('formulas.glaze_formulas_tot_quantity');
if ($this->_view)
if ($this->view)
It looks like you're new here. If you want to get involved, click one of these buttons!