Deployment of non-existing classes / usage in services


#1

Hi all,

I hope some of the Pimcore experts around here may help me with my issue about deployment of new classes in connection with the container and services configuaration.

My case:
I got a running Pimcore skeleton project on a remote machine - VM or dedicated or cloud hosted or anywhere else, doesn’t matter.
Now I deploy my individual code from GIT into the skeleton project including several individual classes which do not exist on the remote stage at this point.
As pimcore suggests in its gitignore I do not deploy the generated DataObject-classes but only the definition php-files. To create the classes remote I would like to use the deployment:classes-rebuild command with -c option.
Besides in my AppBundle I defined a services configuration that registers all controllers as services.

The problem:
As my defined services (e. g. controllers) are using my individual created classes, pimcore, respectively symfony throws an exception as it is not able to initialize the service configuration because the generated DataObject-models of my individual classes are not found. Even when I try to call the pimcore console the same exception is thrown as the symfony configuration is also initialized when using the console.
In addition that means I am not able to create the new classes because of the failed configuration but the configuration fails due to the missing classes.

Of course it would be possible to manually comment out the services in the configuration to do the first step and create the missing classes or to deploy in several steps (first classes, afterwards configuration)
but as I want to automate the deployment process, these approaches seem not to be the best solution.

Am I missing something, are there any possibilities to avoid this scenario?
Or what would be best practice to solve this?

Thanks for any advises!


#2

you can commit the generated classes now to git. They changed that behaviour in Pimcore 5.3 or so.