[Datasource]: Edgecase where datasource is not properly called
Closed this issue · 0 comments
khusseini commented
config.yml
pimcore_rad_brick:
areabricks:
product_listing:
label: Product Listing
use_edit: true
editables:
select_category:
type: relation
options:
types: ['object']
subtypes:
object: ['object']
classes: ["CoreShopCategory"]
datasources:
products:
id: products_by_category
args:
category: 'view.has("select_category") ? (view["select_category"].getElement() ?: null) : null'
options:
page: "request.get('page', 0)"
sort: "request.get('sort', 'name_asc')"
per_page: "request.get('perPage', 9)"
When executing the Areablock products
will always be empty as datasources are only generated in context of doCreateEditables
in AbstractAreaConfigurator
. If a datasource argument is dependent on the view but no elements are bound to the datasource, then the datasource is only once executed while select_category
is in the loop.
Solution:
- In order to skip elements that are not bound to a datasource, the
supportsEditable
method should be altered to allow only editables that have thegroup
configuration. - In order to ensure that the data is being set properly to the view, the
generateDatasources
method should be called withinDatasourceConfigurator::postCreateEditables