contentful / contentful-management.php

Official PHP SDK for the Content Management API
MIT License
7 stars 20 forks source link

Generating entry classes with PHP #168

Open robmellett opened 2 years ago

robmellett commented 2 years ago

Hi there,

I stumbled upon this blog post https://contentful.com/developers/docs/php/tutorials/generating-entry-classes-based-on-content-types-management-sdk/

I was following along the instructions and installed

composer require contentful/contentful-management
composer require --dev nikic/php-parser

However I receive the following error when running

php vendor/bin/contentful-management generate:entry-classes --access-token=$ACCESS_TOKEN --space-id=$SPACE_ID --environment-id=$ENVIRONMENT_ID --dir=$OUTPUT_DIR --namespace="App\\Entity"

Error Could not open input file: vendor/bin/contentful-management

I was just wondering if it's still possible to generate Entities with this library?

Any suggestions would be much appreciated!

Thanks, Rob

Sebb767 commented 2 years ago

Hi @robmellett ,

you're right, it seems composer no longer correctly installs the binary. Code generation itself should still be possible; I'll look into why the install is broken. You can manually add the file, though: https://github.com/contentful/contentful-management.php/blob/master/bin/contentful-management

I'll ping you once I have a solution ready & released :)

robmellett commented 2 years ago

Thanks @Sebb767!

benjamingeorge commented 1 year ago

@robmellett did you ever get code generation to work? I tried the recommendation above but still do not get any files generated and no errors thrown.

ken717w commented 1 year ago

Try:

php vendor/contentful/contentful-management/bin/contentful-management
Sebb767 commented 1 year ago

Hi @robmellett , with v4.1.0 code generation should be fixed. Can you try again?