Cant use pagetype TestPage

Silverstripe Version: 5

Question:
I try to create a page type with Page and Controller Classes, but when i select “Test Page” and hit save, it flips back to “Virtual Page”. What am i doing wrong?

<?php

namespace {
    class TestPage extends Page
    {
        private static $db = [];

        private static $has_one = [];
    }
}
<?php

namespace {
    class TestPageController extends PageController
    {
        private static $allowed_actions = [];

        protected function init()
        {
            parent::init();
        }
    }
}

There’s nothing that immediately jumps out at me as being wrong here - though I do recommend using namespaces on any new classes you create.

If there are errors, you likely have something in your error logs if you’ve configured them which should show you what’s going wrong. You can also try opening the network tab in your browser’s developer tools - when you press save, the new entry there might have an error response code and if so, if you’re in dev mode, there should be some information about the error there.

I haven’t configured the logs, I tried pasting

SS_ERROR_LOG=“./silverstripe.log”

in my .env file but that does not give me a silverstripe.log file. I received no error in the developer tools.

I did find that in my database the enum class for TestPage does not exist. So maybe the flushing is not going the way it supposed to? Weard thing is that it does show up in the CMS

And i did found the answer. I only ran ?flush but did not use /dev/build.
Now requested http://localhost:8888/benb/dev/build?flush=1
pages probably added to the database and it worked.

Thanks again for your response.