I have an issue and instead of asking just how to solve it, I would to better understand what is happening so that I could solve it myself.
Using api-platform 2.6.6, I successfully added an endpoint to SwaggerUI to retrieve a JWT Token. I later upgraded to api-platform 2.7.x-dev and the endpoint is no longer is displayed. While my end goal is to restore the endpoint, my immediate goal is to better understand how Symfony is configured to that it will call a service.
According to the 2.6.6 api-platform documentation to add the endpoint a decorator is added and it is registered as a service.
api/src/OpenApi/JwtDecorator.php
<?php
declare(strict_types=1);
namespace App\OpenApi;
use ApiPlatform\Core\OpenApi\Factory\OpenApiFactoryInterface;
use ApiPlatform\Core\OpenApi\OpenApi;
use ApiPlatform\Core\OpenApi\Model;
final class JwtDecorator implements OpenApiFactoryInterface
{
public function __construct(
private OpenApiFactoryInterface $decorated
) {}
public function __invoke(array $context = []): OpenApi
{
// script goes here.
}
}
api/config/services.yaml
services:
# ...
App\OpenApi\JwtDecorator:
decorates: 'api_platform.openapi.factory'
arguments: ['#.inner']
To ensure that this single service is solely responsible for adding the endpoint, I intentionally did not make any changes to api/config/packages/security.yaml, api/config/routes.yaml, and api/config/packages/api_platform.yaml to ensure they were not causing the endpoint from being displayed on the original 2.6.6 version and they were not. I also looked at what changes were made when using composer to install jwt-auth, and nothing seems relevant. I also found that I could rename JwtDecorator to SomeOtherName and have ruled out that the class name has special meaning.
Next, I placed a debug_print_backtrace() in the App\OpenApi\JwtDecorator file outside of the class, and found that when using either 2.6.6 or 2.7.x-dev, the command is executed and the backtrace is identical. My hypothesis is that upon any request, symfony will first execute include() on every file with a php extension located in src (unless maybe explicitly instructed not to in some config file), check if cache is fresh (and if not create cache files), and use the results to populate the service container. Please confirm whether this is correct.
Backtrace in api/src/OpenApi/JwtDecorator.php file (not in constructor)
#0 include() called at [/srv/api/vendor/symfony/error-handler/DebugClassLoader.php:349] # line 349 for 2.6.6 and 346 for 2.7.x-dev.
#1 Symfony\Component\ErrorHandler\DebugClassLoader->loadClass()
#2 ReflectionClass->__construct() called at [/srv/api/vendor/symfony/config/Resource/ReflectionClassResource.php:107]
#3 Symfony\Component\Config\Resource\ReflectionClassResource->computeHash() called at [/srv/api/vendor/symfony/config/Resource/ReflectionClassResource.php:54]
#4 Symfony\Component\Config\Resource\ReflectionClassResource->isFresh() called at [/srv/api/vendor/symfony/config/Resource/SelfCheckingResourceChecker.php:34]
#5 Symfony\Component\Config\Resource\SelfCheckingResourceChecker->isFresh() called at [/srv/api/vendor/symfony/config/ResourceCheckerConfigCache.php:99]
#6 Symfony\Component\Config\ResourceCheckerConfigCache->isFresh() called at [/srv/api/vendor/symfony/config/ConfigCache.php:60]
#7 Symfony\Component\Config\ConfigCache->isFresh() called at [/srv/api/vendor/symfony/http-kernel/Kernel.php:451]
#8 Symfony\Component\HttpKernel\Kernel->initializeContainer() called at [/srv/api/vendor/symfony/http-kernel/Kernel.php:786]
#9 Symfony\Component\HttpKernel\Kernel->preBoot() called at [/srv/api/vendor/symfony/http-kernel/Kernel.php:187]
#10 Symfony\Component\HttpKernel\Kernel->handle() called at [/srv/api/vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php:37]
#11 Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run() called at [/srv/api/vendor/autoload_runtime.php:35]
#12 require_once(/srv/api/vendor/autoload_runtime.php) called at [/srv/api/public/index.php:5]
Next, I did the same but this time within JwtDecorator's constructor, and it was executed only 2.6.6 but not 2.7.x-dev. Now I know the endpoint is not being displayed because the decorator isn't being called.
I then start looking at the classes in ContainerIx5JWFD, and I find the name of the class is always "get" + servicesClassName + "service". Now I see why I was able to change the name of the service from JwtDecorator to SomeOtherName and it still worked. I also find that the ContainerIx5JWFD\getJwtDecoratorService class only exists for 2.6.6 and not for 2.7.x-dev.
2.6.6 backtrace JwtDecorator::__construct()
#0 App\OpenApi\JwtDecorator->__construct() called at [/srv/api/var/cache/dev/ContainerIx5JWFD/getJwtDecoratorService.php:25]
#1 ContainerIx5JWFD\getJwtDecoratorService::do() called at [/srv/api/var/cache/dev/ContainerIx5JWFD/App_KernelDevDebugContainer.php:644]
#2 ContainerIx5JWFD\App_KernelDevDebugContainer->load() called at [/srv/api/var/cache/dev/ContainerIx5JWFD/getApiPlatform_SwaggerUi_ActionService.php:23]
#3 ContainerIx5JWFD\getApiPlatform_SwaggerUi_ActionService::do() called at [/srv/api/var/cache/dev/ContainerIx5JWFD/App_KernelDevDebugContainer.php:644]
#4 ContainerIx5JWFD\App_KernelDevDebugContainer->load() called at [/srv/api/var/cache/dev/ContainerIx5JWFD/getApiPlatform_Swagger_Action_UiService.php:22]
#5 ContainerIx5JWFD\getApiPlatform_Swagger_Action_UiService::do() called at [/srv/api/var/cache/dev/ContainerIx5JWFD/App_KernelDevDebugContainer.php:644]
#6 ContainerIx5JWFD\App_KernelDevDebugContainer->load() called at [/srv/api/vendor/symfony/dependency-injection/Container.php:237]
#7 Symfony\Component\DependencyInjection\Container->make() called at [/srv/api/vendor/symfony/dependency-injection/Container.php:219]
#8 Symfony\Component\DependencyInjection\Container->get() called at [/srv/api/vendor/symfony/http-kernel/Controller/ContainerControllerResolver.php:53]
#9 Symfony\Component\HttpKernel\Controller\ContainerControllerResolver->instantiateController() called at [/srv/api/vendor/symfony/framework-bundle/Controller/ControllerResolver.php:29]
#10 Symfony\Bundle\FrameworkBundle\Controller\ControllerResolver->instantiateController() called at [/srv/api/vendor/symfony/http-kernel/Controller/ControllerResolver.php:108]
#11 Symfony\Component\HttpKernel\Controller\ControllerResolver->createController() called at [/srv/api/vendor/symfony/http-kernel/Controller/ContainerControllerResolver.php:42]
#12 Symfony\Component\HttpKernel\Controller\ContainerControllerResolver->createController() called at [/srv/api/vendor/symfony/http-kernel/Controller/ControllerResolver.php:86]
#13 Symfony\Component\HttpKernel\Controller\ControllerResolver->getController() called at [/srv/api/vendor/symfony/http-kernel/Controller/TraceableControllerResolver.php:38]
#14 Symfony\Component\HttpKernel\Controller\TraceableControllerResolver->getController() called at [/srv/api/vendor/symfony/http-kernel/HttpKernel.php:139]
#15 Symfony\Component\HttpKernel\HttpKernel->handleRaw() called at [/srv/api/vendor/symfony/http-kernel/HttpKernel.php:78]
#16 Symfony\Component\HttpKernel\HttpKernel->handle() called at [/srv/api/vendor/symfony/http-kernel/Kernel.php:199]
#17 Symfony\Component\HttpKernel\Kernel->handle() called at [/srv/api/vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php:37]
#18 Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run() called at [/srv/api/vendor/autoload_runtime.php:35]
#19 require_once(/srv/api/vendor/autoload_runtime.php) called at [/srv/api/public/index.php:5]
So, to troubleshoot this, I shouldn't be following this code path but really the code which creates these cached files. I am stuck and begging for help. What triggers Symfony to create these classes so that the service is called? How do I determine what is different between the 2.6.6 and 2.7.x-dev so it is only called on 2.6.6?
The most important information: wait for the official release of that library, as it will contain a list of upgrades. Renaming a service (like happened here) will probably be listed there.
To get to the point: by searching for api_platform.openapi.factory in the source code, I've found that the service was renamed in a pull request. The new service name is api_platform.openapi.factory.next
Related
I have this strange issue.
It was not happening before and after I pulled form github ,
when I send json responses and send and eloquent object with it, it gives me this error. Presumably when the model gets serialized.
I've tried to parse it with json_encode but still the same issue.
I don't know whats going on , is it the issue of the json_encode or a problem with the eloquent model.It's related to all the models because all of them return the same error when i try to parse them to json.
It was ok before but now I don't know what went wrong.
I've compared commits to see the differences but still no luck.
I could not find anything that might have caused this issue so I'm guessing it is the fault of an nontracked file so I reinstalled the dependencies again through composer install still no luck.
When I reverse to the last commit it works fine so the theory of the untracked files is rubish.
Has anyone have any idea ?
I'm going nuts over this.
This is the stacktrace form when it starts to convert to json :
[2018-04-18 14:22:53] local.ERROR: Call to undefined method Illuminate\Database\Query\Builder::getEntityAttribute() {"exception":"[object] (BadMethodCallException(code: 0): Call to undefined method Illuminate\\Database\\Query\\Builder::getEntityAttribute() at /home/marlind/PhpstormProjects/ital-restaurant/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:2483)
[stacktrace]
#0 /home/marlind/PhpstormProjects/ital-restaurant/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1288): Illuminate\\Database\\Query\\Builder->__call('getEntityAttrib...', Array)
#1 /home/marlind/PhpstormProjects/ital-restaurant/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1470): Illuminate\\Database\\Eloquent\\Builder->__call('getEntityAttrib...', Array)
#2 /home/marlind/PhpstormProjects/ital-restaurant/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php(438): Illuminate\\Database\\Eloquent\\Model->__call('getEntityAttrib...', Array)
#3 /home/marlind/PhpstormProjects/ital-restaurant/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php(450): Illuminate\\Database\\Eloquent\\Model->mutateAttribute('entity', NULL)
#4 /home/marlind/PhpstormProjects/ital-restaurant/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php(109): Illuminate\\Database\\Eloquent\\Model->mutateAttributeForArray('entity', NULL)
#5 /home/marlind/PhpstormProjects/ital-restaurant/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(970): Illuminate\\Database\\Eloquent\\Model->attributesToArray()
#6 /home/marlind/PhpstormProjects/ital-restaurant/vendor/laravel/framework/src/Illuminate/Support/Collection.php(1611): Illuminate\\Database\\Eloquent\\Model->toArray()
#7 [internal function]: Illuminate\\Support\\Collection->Illuminate\\Support\\{closure}(Object(App\\AdminActivity))
#8 /home/marlind/PhpstormProjects/ital-restaurant/vendor/laravel/framework/src/Illuminate/Support/Collection.php(1612): array_map(Object(Closure), Array)
#9 /home/marlind/PhpstormProjects/ital-restaurant/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php(237): Illuminate\\Support\\Collection->toArray()
#10 /home/marlind/PhpstormProjects/ital-restaurant/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(970): Illuminate\\Database\\Eloquent\\Model->relationsToArray()
#11 /home/marlind/PhpstormProjects/ital-restaurant/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php(237): Illuminate\\Database\\Eloquent\\Model->toArray()
#12 /home/marlind/PhpstormProjects/ital-restaurant/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(970): Illuminate\\Database\\Eloquent\\Model->relationsToArray()
#13 /home/marlind/PhpstormProjects/ital-restaurant/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(999): Illuminate\\Database\\Eloquent\\Model->toArray()
#14 [internal function]: Illuminate\\Database\\Eloquent\\Model->jsonSerialize()
#15 /home/marlind/PhpstormProjects/ital-restaurant/vendor/laravel/framework/src/Illuminate/Http/JsonResponse.php(71): json_encode(Array, 0)
#16 /home/marlind/PhpstormProjects/ital-restaurant/vendor/symfony/http-foundation/JsonResponse.php(50): Illuminate\\Http\\JsonResponse->setData(Array)
#17 /home/marlind/PhpstormProjects/ital-restaurant/vendor/laravel/framework/src/Illuminate/Http/JsonResponse.php(31): Symfony\\Component\\HttpFoundation\\JsonResponse->__construct(Array, 200, Array)
#18 /home/marlind/PhpstormProjects/ital-restaurant/vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php(83): Illuminate\\Http\\JsonResponse->__construct(Array, 200, Array, 0)
#19 /home/marlind/PhpstormProjects/ital-restaurant/app/Http/Controllers/BaseController.php(19): Illuminate\\Routing\\ResponseFactory->json(Array)
#20 /home/marlind/PhpstormProjects/ital-
I assume you have a problem with getting custom attribute. You can do that in a model by writing get{name}Attribute. You didn't provide us with any code so it's hard to point an error.
Old question but found it when searching for a problem I encountered.
Given that the stack trace is similar to mine I think the information and solution I found could shed more light on the matter.
Here's a link to Laravel's documentation about mutators as array:
https://laravel.com/docs/9.x/eloquent-mutators#array-object-and-collection-casting
For me the problem was when doing ->toArray() on a model that had attribute mutators.
Solved it by adding the following to the model:
protected $casts = [
'entity' => AsArrayObject::class,
];
How do I get the root category in a Magento 1.9 update script?
Find root category of store proposes a solution, but I get an error message after running the script:
Mage registry key "controller" already exists
... as well as a trace:
#0 /var/www/instances/global/app/Mage.php(223): Mage::throwException('Mage registry k...')
#1 /var/www/instances/global/app/code/core/Mage/Core/Model/App.php(762): Mage::register('controller', Object(Mage_Core_Controller_Varien_Front))
#2 /var/www/instances/global/app/code/core/Mage/Core/Model/App.php(1113): Mage_Core_Model_App->_initFrontController()
#3 /var/www/instances/global/app/code/core/Mage/Core/Controller/Varien/Front.php(344): Mage_Core_Model_App->getFrontController()
#4 /var/www/instances/global/app/code/core/Mage/Core/Controller/Varien/Front.php(161): Mage_Core_Controller_Varien_Front->_checkBaseUrl(Object(Mage_Core_Controller_Request_Http))
#5 /var/www/instances/global/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#6 /var/www/instances/global/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#7 /var/www/instances/global/index.php(118): Mage::run('', 'store')
#8 {main}
My script calls the Mage::init first, then tries to read the root category name of the store.
Mage::init();
Mage::app()->getStore(3)->getRootCategoryId();
The error message seems to be quite common; Mage registry key "controller" already exists indicates Mage::run might have been run twice.
I therefore assume that Mage::init also should not be called twice, and is maybe invoked again after my update script is invoked - and this could cause my error message. All assumptions.
What could i do? Omit Mage::init()? But then, I do not get the root id. Destroy the object(s) created by Mage::init()? How?
We have many types to access root category id.
1- Mage::app()->getStore($storeId)->getRootCategoryId();
2- Mage::app()->getStore()->getRootCategoryId();
3-
$store = Mage::getModel('core/store')->load(Mage_Core_Model_App::DISTRO_STORE_ID);
$categoryId = $store->getRootCategoryId();
You don't need Mage::init(); nor Mage::run(); in upgrade scripts (installers)!
You can still get the root id after omitting Mage::init();
This code is not elegant, but does not need a Mage::init() call and can therefore invoked in a Magento upgrade script:
$myStoreId = 4;
$myStoresRootCategoryId = null;
foreach (Mage::app()->getStores() as $store) {
$storeId = $store->getId();
$rootCategoryId = $store->getGroup()->getRootCategoryId();
if ($storeId == $myStoreId) {
$myStoresRootCategoryId = $rootCategoryId;
}
}
I just tried to make my own wiki-extension following these tut: Mediawiki - Develop Extensions
The Extensions has a SpecialPage and when i visist the mediawiki - SpecialPages Site i get the following error:
[cb6b6dfb1a33d10f07bcbc44] /index.php/Spezial:Spezialseiten Wikimedia\Assert\ParameterAssertionException from line 63 of D:\Wiki\mediawiki\wiki\vendor\wikimedia\assert\src\Assert.php: Bad value for parameter $dbkey: should not be empty
Backtrace:
#0 D:\Wiki\mediawiki\wiki\includes\title\TitleValue.php(82):Wikimedia\Assert\Assert::parameter(boolean, string, string)
#1 D:\Wiki\mediawiki\wiki\includes\specialpage\SpecialPage.php(100): TitleValue->__construct(integer, string, string)
#2 D:\Wiki\mediawiki\wiki\includes\specialpage\SpecialPage.php(84): SpecialPage::getTitleValueFor(string, boolean, string)
#3 D:\Wiki\mediawiki\wiki\includes\specialpage\SpecialPage.php(629): SpecialPage::getTitleFor(string, boolean)
#4 D:\Wiki\mediawiki\wiki\includes\specials\SpecialSpecialpages.php(70): SpecialPage->getPageTitle()
#5 D:\Wiki\mediawiki\wiki\includes\specials\SpecialSpecialpages.php(42): SpecialSpecialpages->getPageGroups()
#6 D:\Wiki\mediawiki\wiki\includes\specialpage\SpecialPage.php(522): SpecialSpecialpages->execute(NULL)
#7 D:\Wiki\mediawiki\wiki\includes\specialpage\SpecialPageFactory.php(576): SpecialPage->run(NULL)
#8 D:\Wiki\mediawiki\wiki\includes\MediaWiki.php(283): SpecialPageFactory::executePath(Title, RequestContext)
#9 D:\Wiki\mediawiki\wiki\includes\MediaWiki.php(851): MediaWiki->performRequest()
#10 D:\Wiki\mediawiki\wiki\includes\MediaWiki.php(512): MediaWiki->main()
#11 D:\Wiki\mediawiki\wiki\index.php(43): MediaWiki->run()
#12 {main}
with the Debug-notice:
Notice: Did not find alias for special page ''. Perhaps no aliases are defined for it? [Called from SpecialPageFactory::getLocalNameFor in D:\Wiki\mediawiki\wiki\includes\specialpage\SpecialPageFactory.php at line 691] in D:\Wiki\mediawiki\wiki\includes\debug\MWDebug.php on line 311
So why does it search for an empty alias '' when trying to build my SpecialPage?
Could sth gone wrong with my MyExtensions.i18n.alias.php?
or Does any1 know if this kind of error has a deeper meening?
It sounds like an issue with the definition of your special page alias.
Make sure your alias for your SpecialPage is defined correctly, and that the alias page itself is properly attached in your extension in 'ExtensionMessagesFiles' (so it's being read).
See https://www.mediawiki.org/wiki/Manual:Special_pages#The_aliases_file for more information.
Also, you can use https://tools.wmflabs.org/mwstew/ tool to create an extension boilerplate with your special page name and alias generated for you.
I installed FriendsOfCake/cakephp-csvview using
php ../composer.phar require friendsofcake/cakephp-csvview:~3.0.
After which all pages show Missing Controller Exception (they were definitely OK), even after commenting out Plugin::load('CsvView') in bootstrap.php. I doubt php was unable to locate the controller class but don't know why. I have used find . -mtime -1, no files under src have changed.
Could anyone please tell me how Cakephp figures out the class file locations so I can troubleshoot?
Stack trace below:
2016-10-04 03:20:39 Warning: Headers already sent in {base}/vendor/cakephp/cakephp/src/Error/Debugger.php:753
2016-10-04 03:20:39 Error: [Cake\Routing\Exception\MissingControllerException] Controller class Holders could not be found.
Exception Attributes: array (
'class' => 'Holders',
'plugin' => false,
'prefix' => false,
'_ext' => false,
)
Request URL: /
Client IP: 127.0.0.1
Stack Trace:
#0 {base}/vendor/cakephp/cakephp/src/Http/ControllerFactory.php(72): Cake\Http\ControllerFactory->missingController(Object(Cake\Network\Request))
#1 {base}/vendor/cakephp/cakephp/src/Routing/Filter/ControllerFactoryFilter.php(63): Cake\Http\ControllerFactory->create(Object(Cake\Network\Request), Object(Cake\Network\Response))
#2 {base}/vendor/cakephp/cakephp/src/Routing/Filter/ControllerFactoryFilter.php(49): Cake\Routing\Filter\ControllerFactoryFilter->_getController(Object(Cake\Network\Request), Object(Cake\Network\Response))
#3 {base}/vendor/cakephp/cakephp/src/Routing/DispatcherFilter.php(144): Cake\Routing\Filter\ControllerFactoryFilter->beforeDispatch(Object(Cake\Event\Event))
#4 {base}/vendor/cakephp/cakephp/src/Event/EventManager.php(426): Cake\Routing\DispatcherFilter->handle(Object(Cake\Event\Event), Object(Cake\Network\Request), Object(Cake\Network\Response))
#5 {base}/vendor/cakephp/cakephp/src/Event/EventManager.php(391): Cake\Event\EventManager->_callListener(Array, Object(Cake\Event\Event))
#6 {base}/vendor/cakephp/cakephp/src/Event/EventDispatcherTrait.php(78): Cake\Event\EventManager->dispatch(Object(Cake\Event\Event))
#7 {base}/vendor/cakephp/cakephp/src/Http/ActionDispatcher.php(81): Cake\Http\ActionDispatcher->dispatchEvent('Dispatcher.befo...', Array)
#8 {base}/vendor/cakephp/cakephp/src/Routing/Dispatcher.php(60): Cake\Http\ActionDispatcher->dispatch(Object(Cake\Network\Request), Object(Cake\Network\Response))
#9 {base}/webroot/index.php(37): Cake\Routing\Dispatcher->dispatch(Object(Cake\Network\Request), Object(Cake\Network\Response))
#10 {main}
If at all, CakePHP only tries to figure fully qualified classnames from shorter ones, it doesn't handle including class files or figuring their locations, as of CakePHP 3 it relies on the composer autoloader (vendor/autoload.php) to do that.
If things broke after updating a dependency, which will also cause the autoloader to be re-dumped, chances are good that the autoloader broke (for whatever reason).
I'm using CakePHP v3.x and my app doesn't have any models but I'd like to back a couple views or controllers.
$ bin/cake bake template Reports
I tried:
* using the --connection option with false or an empty string
* Removing Datasources from app.php
* Leaving in Datasources but set Datasources['default'] to false
All of these result in an error:
Welcome to CakePHP v3.1.2 Console
---------------------------------------------------------------
App : src
Path: /Applications/MAMP/htdocs/listings/src/
PHP : 5.6.10
---------------------------------------------------------------
Exception: The datasource configuration "default" was not found. in [/Applications/MAMP/htdocs/listings/vendor/cakephp/cakephp/src/Datasource/ConnectionManager.php, line 187]
2015-10-22 02:30:48 Error: [Cake\Datasource\Exception\MissingDatasourceConfigException] The datasource configuration "default" was not found.
Exception Attributes: array (
'name' => 'default',
)
Stack Trace:
#0 /Applications/MAMP/htdocs/listings/vendor/cakephp/cakephp/src/ORM/Locator/TableLocator.php(164): Cake\Datasource\ConnectionManager::get('default')
#1 /Applications/MAMP/htdocs/listings/vendor/cakephp/cakephp/src/ORM/TableRegistry.php(109): Cake\ORM\Locator\TableLocator->get('Reports', Array)
#2 /Applications/MAMP/htdocs/listings/vendor/cakephp/bake/src/Shell/Task/TemplateTask.php(282): Cake\ORM\TableRegistry::get('Reports')
#3 /Applications/MAMP/htdocs/listings/vendor/cakephp/bake/src/Shell/Task/TemplateTask.php(147): Bake\Shell\Task\TemplateTask->_loadController()
#4 [internal function]: Bake\Shell\Task\TemplateTask->main('Reports')
#5 /Applications/MAMP/htdocs/listings/vendor/cakephp/cakephp/src/Console/Shell.php(447): call_user_func_array(Array, Array)
#6 /Applications/MAMP/htdocs/listings/vendor/cakephp/cakephp/src/Console/Shell.php(442): Cake\Console\Shell->runCommand(Array, false)
#7 /Applications/MAMP/htdocs/listings/vendor/cakephp/cakephp/src/Console/ShellDispatcher.php(212): Cake\Console\Shell->runCommand(Array, true, Array)
#8 /Applications/MAMP/htdocs/listings/vendor/cakephp/cakephp/src/Console/ShellDispatcher.php(179): Cake\Console\ShellDispatcher->_dispatch(Array)
#9 /Applications/MAMP/htdocs/listings/vendor/cakephp/cakephp/src/Console/ShellDispatcher.php(126): Cake\Console\ShellDispatcher->dispatch(Array)
#10 /Applications/MAMP/htdocs/listings/bin/cake.php(33): Cake\Console\ShellDispatcher::run(Array)
#11 {main}
I doubt this will work any time soon. You can create feature request type ticket on Github but it's unlikely to happen, because bake uses the DB schema to read the fields and builds everything based on the schema.
Also the Table class, which replaced Model from Cake2, doesn't allow $useTable = false any more. Because a table requires a DB table. For model less forms see this link.