Karaka-Management / phpOMS

PHP Framework
Other
2 stars 0 forks source link

Select or join bug when requesting hasMany elements that may or may not have a certain child value #356

Open spl1nes opened 7 months ago

spl1nes commented 7 months ago

File: phpOMS/DataStorage/Database/Mapper/ReadMapper.php

The following mapper get example doesn't return any attributes that have no value/l11n component:

VehicleMapper::get()
    ->with('attributes')
    ->with('attributes/type')
    ->with('attributes/value')
    ->with('attributes/type/l11n')
    ->with('attributes/value/l11n')
    ->where('id', (int) $request->getData('id'))
    ->where('attributes/type/l11n/language', $response->header->l11n->language)
    ->where('attributes/value/l11n/language', $response->header->l11n->language)
    ->execute();

Only some attribute values have a localization but if we perform the above mentioned get we will only get the attributes that have a value with a l11n.

For the type this is no problem since all types have a l11n.