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

Fatal error: Class 'DocuSign\eSign\Api\EnvelopesApi\ListStatusChangesOptions' not found #23

Open
mdesign83 opened this issue Jul 19, 2016 · 15 comments
Assignees

Comments

@mdesign83
Copy link

Dear Devs,

Composer can't load the subject class.
Please generate separate php files per namespaces/classes in under proper directory path.

<?php
require 'vendor/autoload.php';

$options = new DocuSign\eSign\Api\EnvelopesApi\ListStatusChangesOptions();
// results: Fatal error: Uncaught Error: Class 'DocuSign\eSign\Api\EnvelopesApi\ListStatusChangesOptions' not found in ...

The class in the file src/Api/EnvelopesApi.php instead of src/Api/EnvelopesApi/ListStatusChangesOptions.php regarding to its namespace.
Relating docs to your psr-4 composer setting: http://www.php-fig.org/psr/psr-4

Best regards,
Karoly

@theBull
Copy link

theBull commented May 14, 2017

after the require statement, try:

use DocuSign\eSign\Api\EnvelopesApi\ListStatusChangesOptions;

and then replace:
$options = new DocuSign\eSign\Api\EnvelopesApi\ListStatusChangesOptions();
to:
$options = new ListStatusChangesOptions();

@mdesign83
Copy link
Author

Dear @theBull,
Have you tried this? Is it work for you?

I made the steps in the readme but got the same fatal error:

  1. composer require docusign/esign-client
  2. create a test.php with content
<?php
require 'vendor/autoload.php';
use DocuSign\eSign\Api\EnvelopesApi\ListStatusChangesOptions;
$options = new ListStatusChangesOptions();

I receive these messages:
PHP 5.6.19: Fatal error: Class 'DocuSign\eSign\Api\EnvelopesApi\ListStatusChangesOptions' not found in bug.php on line 4
PHP 7.1.2: Fatal error: Uncaught Error: Class 'DocuSign\eSign\Api\EnvelopesApi\ListStatusChangesOptions' not found in bug.php:4 Stack trace: #0 {main} thrown in bug.php on line 4

@gsnavin
Copy link
Contributor

gsnavin commented Jun 15, 2017

@mdesign83 Please use the following and it should work. You can find working example in the unit test cases. Hope that helps.
$options = new \DocuSign\eSign\Api\EnvelopesApi\ListStatusChangesOptions();

@gsnavin gsnavin closed this as completed Jun 15, 2017
@mdesign83
Copy link
Author

The main problem is the generated php source is not PSR-4 compatible:
http://www.php-fig.org/psr/psr-4

The subdirectory name MUST match the case of the sub-namespace names.

But neither EnvelopesApi directory exists, nor ListStatusChangesOptions is a separate file.

If I split EnvelopesApi.php file to separate classes in EnvelopesApi directory, everything is fine.

@moromete
Copy link

moromete commented May 6, 2020

The problem is still there. Please split the classes in separate files.

@yohio
Copy link

yohio commented Jul 16, 2020

The issue still persists.

@alxvgt
Copy link

alxvgt commented Oct 21, 2020

I see this issue is already closed but i encountered the same problem with an integration in Symfony.

Attempted to load class "ListTemplatesOptions" from namespace "DocuSign\eSign\Api\TemplatesApi".
Did you forget a "use" statement for another namespace?

Here is my code block :

        $options = new \DocuSign\eSign\Api\TemplatesApi\ListTemplatesOptions();
        $options->setInclude(DocuSignClient::OPTION_CUSTOM_FIELDS);

        $dsTemplateApi = new \DocuSign\eSign\Api\TemplatesApi($this->docuSignClient);
        $templates = $dsTemplateApi->listTemplates($this->docuSignClient->getAccountId(), $options);

It seems that the psr4 autoload rules is not respected. The filename need to be the same than the class name as the path need to match the namespace.
@gsnavin Could you reopen this issue ?

@alxvgt
Copy link

alxvgt commented Oct 21, 2020

A workaround can be used if you edit your composer.json as shown beelow. You can add a "classmap" entry to generate an additional autoload mapping.

    "autoload": {
        "psr-4": {
            "App\\": "src/"
        },
        "classmap": [
            "vendor/docusign/esign-client/src"
        ]
    },

@adrienfr
Copy link

adrienfr commented Sep 9, 2021

@LarryKlugerDS is it possible to re-open this issue or should we create another one?

The issue is still here, psr-4 autoload is not respected in DocuSign\eSign\Api\TemplatesApi.php and DocuSign\eSign\Api\EnvelopesApi.php, there should be only one file for each class.

@LarryKlugerDS LarryKlugerDS reopened this Sep 9, 2021
@LarryKlugerDS
Copy link
Contributor

@adrienfr -- Thank you for your comment. I've re-opened the issue and notified the product manager. He'll work with our engineering group on the issue.

@hcker2000
Copy link

I also just ran into this issue just now. Any updates on this?

@adrienfr
Copy link

@LarryKlugerDS any news regarding this issue?

Because of the current behavior, we can't use the API to re-send an envelope and have to manually do this through our Docusign account, not very time effective :/

@adrienfr
Copy link

@harsharahul, could we please have your input on this issue?

@szhorvath
Copy link

I have the same issue with template options.

@vroomfondle
Copy link

vroomfondle commented Oct 10, 2023

Just to note, this has just caused us problems while trying to get our new DocuSign-based solution up and running. We used the composer workaround given by @alxvgt and that works alright (thanks @alxvgt !) but it's a pretty poor developer experience when something as basic as this doesn't function properly. PSR-4 has been the standard for PHP autoloading for many years now and PHP devs tend to assume it'll "just work"...

If it can't be fixed (which would be a shame), could it be mentioned somewhere in DocuSign's main developer documentation to make it more obvious and stop future developers from wasting their time?

(EDIT: I see it is actually mentioned here: https://developers.docusign.com/docs/esign-rest-api/sdks/php/setup-and-configuration/ ... but, it's under the "Downloading the SDK from the GitHub repository" heading which is likely to be ignored by a lot of developers as they'll have just followed the composer instructions in the previous section).

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