I think it's bad practice, that the main category (aka ParentID) isn't added to ProductCategories manymany relation. This makes it harder to find e.g. all products of a given category programatically or when you want to export data to other data stores like SOLR for searching.
Proposal:
add ParentID and ancestors' IDs to ProductCategories in onAfterWrite() if not already added
write a task that checks if those IDs are added to ProductCategories and add them if not
getCategories() is a workaround for this right now, but having the data stored in DB is better IMHO
I think it's bad practice, that the main category (aka ParentID) isn't added to ProductCategories manymany relation. This makes it harder to find e.g. all products of a given category programatically or when you want to export data to other data stores like SOLR for searching.
Proposal:
getCategories()
is a workaround for this right now, but having the data stored in DB is better IMHO