I got quite far in utilizing Kirby to edit a database in panels.
How do you ideally deal with existing data that is relying on IDs instead of Slugs?
I understand that in order to create a new record (file or database), a new slug has to be created (as identifier on the filesystem). Since the database is wrapped around the file based way of creating data this is true for adding a new record to a database as well, but it’s quite awkward.
To make the backend work with legacy data without slugs, I use the ID as slug until they have one:
public function children()
{
$data = [];
foreach (Db::select('partner') as $i => $partner) {
$data[] = [
'slug' => $partner->slug() ?? $partner->id() ,
// ...
'content' => []
}
}
That kind of works, but it’s weird.
How do you, who implemented databases in panels, deal with this?
Are there better ways than overwriting all these Pagemethods like changeStatusToDraft()
for every model? (Plugins?)
Last question: i it annoying that people ask for something that Kirby wasn’t intended for in the first place? ^^