Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught BadMethodCallException: Object->__call(): the method 'isPublished' does not exist on 'SilverStripe\UserForms\Model\Submission\SubmittedForm' #802

Closed
ghost opened this issue Aug 27, 2018 · 7 comments

Comments

@ghost
Copy link

ghost commented Aug 27, 2018

Uncaught BadMethodCallException: Object->__call(): the method 'isPublished' does not exist on 'SilverStripe\UserForms\Model\Submission\SubmittedForm'

I get this error after:

  1. creating a user-defined-form page
  2. creating a form
  3. completing and submitting form
  4. Clicking on individual submission in submissions tab on form page

Installed version (via composer show) is silverstripe/userforms 5.2.1

Please could you advise how to correct this? Thanks.

@robbieaverill
Copy link
Contributor

robbieaverill commented Aug 27, 2018

@CapicheDesign thanks, can you please provide the version of silverstripe/cms you're using too? Edit: actually, can you provide a paste of the full output of composer show?

@ghost
Copy link
Author

ghost commented Aug 27, 2018

No problem:

composer/ca-bundle                        1.1.2
composer/installers                       v1.5.0
doctrine/instantiator                     1.0.5
embed/embed                               v3.3.5
guzzlehttp/psr7                           1.4.2
intervention/image                        2.4.2
league/csv                                8.2.3
league/flysystem                          1.0.45
m1/env                                    2.1.2
marcj/topsort                             1.1.0
monolog/monolog                           1.23.0
myclabs/deep-copy                         1.7.0
nikic/php-parser                          v3.1.5
paragonie/random_compat                   v2.0.17
phpdocumentor/reflection-common           1.0.1
phpdocumentor/reflection-docblock         3.3.2
phpdocumentor/type-resolver               0.4.0
phpspec/prophecy                          1.8.0
phpunit/php-code-coverage                 4.0.8
phpunit/php-file-iterator                 1.4.5
phpunit/php-text-template                 1.2.1
phpunit/php-timer                         1.0.9
phpunit/php-token-stream                  1.4.12
phpunit/phpunit                           5.7.27
phpunit/phpunit-mock-objects              3.4.4
psr/cache                                 1.0.1
psr/container                             1.0.0
psr/http-message                          1.0.1
psr/log                                   1.0.2
psr/simple-cache                          1.0.1
sebastian/code-unit-reverse-lookup        1.0.1
sebastian/comparator                      1.2.4
sebastian/diff                            1.4.3
sebastian/environment                     2.0.0
sebastian/exporter                        2.0.0
sebastian/global-state                    1.1.1
sebastian/object-enumerator               2.0.1
sebastian/recursion-context               2.0.0
sebastian/resource-operations             1.0.0
sebastian/version                         2.0.1
silverstripe/admin                        1.2.1
silverstripe/asset-admin                  1.2.1
silverstripe/assets                       1.2.1
silverstripe/campaign-admin               1.2.1
silverstripe/cms                          4.2.1
silverstripe/config                       1.0.6
silverstripe/errorpage                    1.2.1
silverstripe/framework                    4.2.1
silverstripe/graphql                      2.0.1
silverstripe/recipe-cms                   4.2.1
silverstripe/recipe-core                  4.2.1
silverstripe/recipe-plugin                1.3.0
silverstripe/reports                      4.2.1
silverstripe/segment-field                2.2.1
silverstripe/siteconfig                   4.2.1
silverstripe/userforms                    5.2.1
silverstripe/vendor-plugin                1.3.3
silverstripe/versioned                    1.2.1
swiftmailer/swiftmailer                   v5.4.12
symbiote/silverstripe-gridfieldextensions 3.2.0
symfony/cache                             v3.4.14
symfony/config                            v3.4.14
symfony/filesystem                        v3.4.14
symfony/finder                            v3.4.14
symfony/polyfill-apcu                     v1.9.0
symfony/polyfill-ctype                    v1.9.0
symfony/polyfill-mbstring                 v1.9.0
symfony/translation                       v2.8.44
symfony/yaml                              v3.4.14
unclecheese/betterbuttons                 dev-feature/ss4-upgrade 9e6e563
webmozart/assert                          1.3.0
webonyx/graphql-php                       v0.8.0

@robbieaverill
Copy link
Contributor

Thanks, also if possible could you provide a full stack trace of that error?

@ghost
Copy link
Author

ghost commented Aug 27, 2018

Here's everything I get when I send the URL with ?isDev=1 attached:

edit: have just removed user name from CustomMethods.php path for privacy.

[Emergency] Uncaught BadMethodCallException: Object->__call(): the method 'isPublished' does not exist on 'SilverStripe\UserForms\Model\Submission\SubmittedForm'
GET /admin/pages/edit/EditForm/14/field/Submissions/item/5/edit?isDev=1&isDevtoken=b880feb63f23204c3fa8aeab556fcb62
Line 54 in /Users/.../Sites/standalone/una-nz/vendor/silverstripe/framework/src/Core/CustomMethods.php

Source
45      * @throws BadMethodCallException
46      */
47     public function __call($method, $arguments)
48     {
49         // If the method cache was cleared by an an Object::add_extension() / Object::remove_extension()
50         // call, then we should rebuild it.
51         $class = static::class;
52         $config = $this->getExtraMethodConfig($method);
53         if (empty($config)) {
54             throw new BadMethodCallException(
55                 "Object->__call(): the method '$method' does not exist on '$class'"
56             );
57         }
58 
59         switch (true) {
60             case isset($config['callback']): {
Trace
SilverStripe\View\ViewableData->__call(isPublished, Array) 
Delete.php:50
SilverStripe\UserForms\Model\Submission\SubmittedForm->isPublished() 
Delete.php:50
UncleCheese\BetterButtons\Buttons\Delete->shouldDisplay() 
BetterButtonsItemRequest.php:93
UncleCheese\BetterButtons\Controllers\VersionedItemRequest->filterFieldList(SilverStripe\Forms\FieldList) 
VersionedItemRequest.php:68
UncleCheese\BetterButtons\Controllers\VersionedItemRequest->getFormActions() 
GridFieldDetailForm_ItemRequest.php:189
SilverStripe\Forms\GridField\GridFieldDetailForm_ItemRequest->ItemEditForm() 
GridFieldDetailForm_ItemRequest.php:137
SilverStripe\Forms\GridField\GridFieldDetailForm_ItemRequest->edit(SilverStripe\Control\HTTPRequest) 
RequestHandler.php:320
SilverStripe\Control\RequestHandler->handleAction(SilverStripe\Control\HTTPRequest, edit) 
RequestHandler.php:202
SilverStripe\Control\RequestHandler->handleRequest(SilverStripe\Control\HTTPRequest) 
GridFieldDetailForm.php:118
SilverStripe\Forms\GridField\GridFieldDetailForm->handleItem(SilverStripe\Forms\GridField\GridField, SilverStripe\Control\HTTPRequest) 
GridField.php:1031
SilverStripe\Forms\GridField\GridField->handleRequest(SilverStripe\Control\HTTPRequest) 
RequestHandler.php:226
SilverStripe\Control\RequestHandler->handleRequest(SilverStripe\Control\HTTPRequest) 
RequestHandler.php:226
SilverStripe\Control\RequestHandler->handleRequest(SilverStripe\Control\HTTPRequest) 
Controller.php:212
SilverStripe\Control\Controller->handleRequest(SilverStripe\Control\HTTPRequest) 
LeftAndMain.php:755
SilverStripe\Admin\LeftAndMain->handleRequest(SilverStripe\Control\HTTPRequest) 
AdminRootController.php:123
SilverStripe\Admin\AdminRootController->handleRequest(SilverStripe\Control\HTTPRequest) 
Director.php:361
SilverStripe\Control\Director->SilverStripe\Control\{closure}(SilverStripe\Control\HTTPRequest) 
VersionedHTTPMiddleware.php:40
SilverStripe\Versioned\VersionedHTTPMiddleware->process(SilverStripe\Control\HTTPRequest, Closure) 
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest) 
BasicAuthMiddleware.php:68
SilverStripe\Security\BasicAuthMiddleware->process(SilverStripe\Control\HTTPRequest, Closure) 
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest) 
AuthenticationMiddleware.php:61
SilverStripe\Security\AuthenticationMiddleware->process(SilverStripe\Control\HTTPRequest, Closure) 
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest) 
CanonicalURLMiddleware.php:188
SilverStripe\Control\Middleware\CanonicalURLMiddleware->process(SilverStripe\Control\HTTPRequest, Closure) 
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest) 
HTTPCacheControlMiddleware.php:42
SilverStripe\Control\Middleware\HTTPCacheControlMiddleware->process(SilverStripe\Control\HTTPRequest, Closure) 
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest) 
ChangeDetectionMiddleware.php:27
SilverStripe\Control\Middleware\ChangeDetectionMiddleware->process(SilverStripe\Control\HTTPRequest, Closure) 
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest) 
FlushMiddleware.php:29
SilverStripe\Control\Middleware\FlushMiddleware->process(SilverStripe\Control\HTTPRequest, Closure) 
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest) 
RequestProcessor.php:66
SilverStripe\Control\RequestProcessor->process(SilverStripe\Control\HTTPRequest, Closure) 
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest) 
SessionMiddleware.php:20
SilverStripe\Control\Middleware\SessionMiddleware->process(SilverStripe\Control\HTTPRequest, Closure) 
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest) 
AllowedHostsMiddleware.php:60
SilverStripe\Control\Middleware\AllowedHostsMiddleware->process(SilverStripe\Control\HTTPRequest, Closure) 
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest) 
TrustedProxyMiddleware.php:176
SilverStripe\Control\Middleware\TrustedProxyMiddleware->process(SilverStripe\Control\HTTPRequest, Closure) 
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest) 
HTTPMiddlewareAware.php:65
SilverStripe\Control\Director->callMiddleware(SilverStripe\Control\HTTPRequest, Closure) 
Director.php:370
SilverStripe\Control\Director->handleRequest(SilverStripe\Control\HTTPRequest) 
HTTPApplication.php:48
SilverStripe\Control\HTTPApplication->SilverStripe\Control\{closure}(SilverStripe\Control\HTTPRequest) 
call_user_func(Closure, SilverStripe\Control\HTTPRequest) 
HTTPApplication.php:66
SilverStripe\Control\HTTPApplication->SilverStripe\Control\{closure}(SilverStripe\Control\HTTPRequest) 
call_user_func(Closure, SilverStripe\Control\HTTPRequest) 
ErrorControlChainMiddleware.php:56
SilverStripe\Core\Startup\ErrorControlChainMiddleware->SilverStripe\Core\Startup\{closure}(SilverStripe\Core\Startup\ErrorControlChain) 
call_user_func(Closure, SilverStripe\Core\Startup\ErrorControlChain) 
ErrorControlChain.php:236
SilverStripe\Core\Startup\ErrorControlChain->step() 
ErrorControlChain.php:226
SilverStripe\Core\Startup\ErrorControlChain->execute() 
ErrorControlChainMiddleware.php:69
SilverStripe\Core\Startup\ErrorControlChainMiddleware->process(SilverStripe\Control\HTTPRequest, Closure) 
HTTPMiddlewareAware.php:62
SilverStripe\Control\HTTPApplication->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest) 
HTTPMiddlewareAware.php:65
SilverStripe\Control\HTTPApplication->callMiddleware(SilverStripe\Control\HTTPRequest, Closure) 
HTTPApplication.php:67
SilverStripe\Control\HTTPApplication->execute(SilverStripe\Control\HTTPRequest, Closure, ) 
HTTPApplication.php:49
SilverStripe\Control\HTTPApplication->handle(SilverStripe\Control\HTTPRequest) 
index.php:25

@robbieaverill
Copy link
Contributor

Yes, I suspected that would be the case:

SilverStripe\UserForms\Model\Submission\SubmittedForm->isPublished() 
Delete.php:50
UncleCheese\BetterButtons\Buttons\Delete->shouldDisplay() 
BetterButtonsItemRequest.php:93
UncleCheese\BetterButtons\Controllers\VersionedItemRequest->filterFieldList(SilverStripe\Forms\FieldList) 
VersionedItemRequest.php:68

The problem is that the "unclecheese/betterbuttons" module isn't correctly checking whether the record is versioned:

https://github.com/unclecheese/silverstripe-gridfield-betterbuttons/blob/feature/ss4-upgrade/src/Buttons/Delete.php#L50

Thanks for reporting, please take this up with the module author

@robbieaverill
Copy link
Contributor

@CapicheDesign it looks like unclecheese/silverstripe-gridfield-betterbuttons#181 fixes your problem by the way

@ghost
Copy link
Author

ghost commented Aug 27, 2018

Awesome thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant