Page models in subfolder of plugin: Why is syntax different to templates/snippets?

In many of my v2 projects I use custom page models based on the page class. As of now, I am trying to upgrade a project to v3 and can’t get models in my plugin to work.

Because I have many models, I organize them in a subfolder of my plugin:

site/plugins/my-plugin/models

I do the same with templates/snippets:

site/plugins/my-plugin/templates
site/plugins/my-plugin/snippets

and loading them works fine via the given syntax:

Kirby::plugin('os/my-plugin', [
    'templates' => [
        'blog' => __DIR__ . '/templates/blog.php'
    ]
]);

Doing the same with the page model

Kirby::plugin('os/my-plugin', [
    'pageModels' => [
        'blog' => 'BlogPage'
    ]
]);

doesn’t work because there seems to be no way to get the right directory. Is there a way to do that? And why is the syntax different? I expected something like this (where I can set the directory):

Kirby::plugin('os/my-plugin', [
    'pageModels' => [
        'blog' => __DIR__ . 'blog.php'
    ]
]);

I get that Kirby needs to know the class it should load (which would not be known in my example), but what about the folder it is in?

In your index.php

<?php

require_once   __DIR__ . '/src/models/NotesPage.php';

Kirby::plugin('my/pageModels', [
    'pageModels' => [
        'notes' =>  'NotesPage'
    ]
]);

Then define your class in src/models/NotesPage.php

Thank you, Sonja! I just didn’t see the obvious way…

Came across that problem again today and am still wondering why this is not implemented like snippets/templates an so on. In particular because it works within the models folder in site…

Because with the page models, we are loading classes, and they can be autoloaded via Composer, for example.