Search code examples
phpsymfonycomposer-phpvendor

Use another symfony2 project as vendor


I have three projects X, Y and Z.

Project X does some admin functions for Y poject. The Entities for project Y are writen in the AppBudnle vendor. Now, I would like to also do some admin tasks for the project Z in X, but project Z has all entities in the src/Company/Z/Entity/...

I included the project Z as vendor in the project X with this autoload:

"autoload": {
            "psr-0": {
                "Company\\Z\\": ""
            }
        },

But when adding this to the AppKernel in the project X, it complains that

PHP Fatal error:  Class 'Company\ZBundle\ZBundle' not found in ....

Am I missing something in the autoload?

The project Z entities dir is seen like this in the X project:

/vendor/company/z-bundle/company/ZBundle/src/company/ZBundle/Entity

Solution

  • I create an answer because comment section is too short :

    In your composer.json try something like this, according to your own project :

         "repositories": [
                {
                    "type": "vcs",
                    "url": "[email protected]:You/companyZBundle.git"
                },
         ], 
         "require": {
               "php": ">=5.3.9",
             ...
            "You/companyZBundle": "dev-master@dev"
          }
    

    In your AppKernel :

    new Company\ZBundle\ZBundle()
    

    And, as Cerad said, be careful about case !