Ocramius / ProxyManager

🎩✨🌈 OOP Proxy wrappers/utilities - generates and manages proxies of your objects
MIT License
4.96k stars 187 forks source link

Fatal error: Class 'ProxyManager\Versions' not found #294

Closed Tomsgu closed 8 years ago

Tomsgu commented 8 years ago

Hi, I am not sure if I write here corectly.

I got this error: [Symfony\Component\Debug\Exception\FatalThrowableError] Fatal error: Class 'ProxyManager\Versions' not found when I run doctrine migrate. Does it related with a bug(ProxyManager/DocrineMigrations) or somebody know, what can be a problem?

Php: 7.0.3 ProxyManager: 2.0.0 DoctrineMigrations: 1.1.0

Ocramius commented 8 years ago

@Tomsgu does composer run any script at install time? It should show something like Generating version class at finished installation.

Tomsgu commented 8 years ago

Thanks for your response @Ocramius. Composer tries to generate these classes but ends up with undefined index: source exception.

$composer update ... Generating autoload files ocramius/package-versions: Generating version class... [ErrorException] Undefined index: source

Ocramius commented 8 years ago

So that's where it hangs... Needs to be debugged, but that's a bug in https://github.com/Ocramius/PackageVersions then.

Could you try running with more verbose settings?

Tomsgu commented 8 years ago
$composer update -v

Exception trace:
 () at /home/tomsgu/Project/tz2m3/vendor/ocramius/package-versions/src/PackageVersions/Installer.php:189
 Composer\Util\ErrorHandler::handle() at /home/tomsgu/Project/tz2m3/vendor/ocramius/package-versions/src/PackageVersions/Installer.php:189
 PackageVersions\Installer::getVersions() at n/a:n/a
 iterator_to_array() at /home/tomsgu/Project/tz2m3/vendor/ocramius/package-versions/src/PackageVersions/Installer.php:104
 PackageVersions\Installer::generateVersionsClass() at /home/tomsgu/Project/tz2m3/vendor/ocramius/package-versions/src/PackageVersions/Installer.php:90
 PackageVersions\Installer::dumpVersionsClass() at n/a:n/a
 call_user_func() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:166
 Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:94
 Composer\EventDispatcher\EventDispatcher->dispatchScript() at phar:///usr/local/bin/composer/src/Composer/Installer.php:350
 Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/UpdateCommand.php:158
 Composer\Command\UpdateCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:259
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:844
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:192
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:166
 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:123
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:99
 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:43
 require() at /usr/local/bin/composer:25
Ocramius commented 8 years ago

Does the same happen when you run with --prefer-source?

Tomsgu commented 8 years ago

Yes, the same problem.

Ocramius commented 8 years ago

Could you list the packages you have in your composer.json? Maybe it depends on one of the packages only having a dist version...

Tomsgu commented 8 years ago

Ok list of installed packages: installed:

  beberlei/DoctrineExtensions              v1.0.6             A set of extensions to Doctrine 2 that add support for additional query functions available in MySQL and Oracle.
  behat/transliterator                     v1.1.0             String transliterator
  braincrafted/bootstrap-bundle            dev-master 23ae420 BraincraftedBootstrapBundle integrates Bootstrap into Symfony2 by providing templates, Twig extensions, services and co...
  cocur/slugify                            v1.4.1             Converts a string into a slug.
  doctrine/annotations                     v1.2.7             Docblock Annotations Parser
  doctrine/cache                           v1.6.0             Caching library offering an object-oriented API for many cache backends
  doctrine/collections                     v1.3.0             Collections Abstraction library
  doctrine/common                          v2.6.1             Common Library for Doctrine projects
  doctrine/data-fixtures                   v1.1.1             Data Fixtures for all Doctrine Object Managers
  doctrine/dbal                            v2.4.5             Database Abstraction Layer
  doctrine/doctrine-bundle                 1.6.2              Symfony DoctrineBundle
  doctrine/doctrine-cache-bundle           1.3.0              Symfony Bundle for Doctrine Cache
  doctrine/doctrine-fixtures-bundle        v2.2.1             Symfony DoctrineFixturesBundle
  doctrine/doctrine-migrations-bundle      dev-master e251191 Symfony DoctrineMigrationsBundle
  doctrine/inflector                       v1.0.1             Common String Manipulations with regard to casing and singular/plural rules.
  doctrine/instantiator                    1.0.5              A small, lightweight utility to instantiate objects in PHP without invoking their constructors
  doctrine/lexer                           v1.0.1             Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
  doctrine/migrations                      dev-master 7ab492c Database Schema migrations using Doctrine DBAL
  doctrine/orm                             v2.4.8             Object-Relational-Mapper for PHP
  friendsofsymfony/rest-bundle             1.3.1              This Bundle provides various tools to rapidly develop RESTful API's with Symfony2
  friendsofsymfony/user-bundle             v1.3.6             Symfony FOSUserBundle
  gedmo/doctrine-extensions                v2.4.12            Doctrine2 behavioral extensions
  genemu/form-bundle                       v2.2.2             Extra form types for your Symfony2 projects
  incenteev/composer-parameter-handler     v2.1.2             Composer script handling your ignored parameter file
  ircmaxell/password-compat                v1.0.4             A compatibility library for the proposed simplified password hashing algorithm: https://wiki.php.net/rfc/password_hash
  jdorn/sql-formatter                      v1.2.17            a PHP SQL highlighting library
  jeroendesloovere/vcard                   1.2.2              This VCard PHP class can generate a vCard with some data. When using an iOS device it will export as a .ics file becaus...
  jeroendesloovere/vcard-bundle            1.2.1              This Symfony 2 bundle can generate vCards with lots of data. When using an < iOS 7 device it will export as a .ics file...
  jms/aop-bundle                           1.2.0              Adds AOP capabilities to Symfony2
  jms/cg                                   1.1.0              Toolset for generating PHP code
  jms/di-extra-bundle                      dev-master 6593189 Allows to configure dependency injection using annotations
  jms/metadata                             1.5.1              Class/method/property metadata management in PHP
  jms/parser-lib                           1.0.0              A library for easily creating recursive-descent parsers.
  jms/serializer                           0.16.0             Library for (de-)serializing data of any complexity; supports XML, JSON, and YAML.
  jms/serializer-bundle                    0.13.0             Allows you to easily serialize, and deserialize data of any complexity
  jms/translation-bundle                   dev-master c97c571 Puts the Symfony Translation Component on steroids
  jquery/jquery                            1.10.2             
  knplabs/knp-components                   1.3.2              Knplabs component library
  knplabs/knp-menu                         v2.1.1             An object oriented menu library
  knplabs/knp-menu-bundle                  dev-master 3cee352 This bundle provides an integration of the KnpMenu library
  knplabs/knp-paginator-bundle             2.5.1              Paginator bundle for Symfony2 to automate pagination and simplify sorting and other features
  knplabs/knp-snappy                       0.4.3              PHP5 library allowing thumbnail, snapshot or PDF generation from a url or a html page. Wrapper for wkhtmltopdf/wkhtmlto...
  knplabs/knp-snappy-bundle                dev-master ead0b44 Easily create PDF and images in Symfony2 by converting Twig/HTML templates.
  kriswallsmith/assetic                    v1.3.2             Asset Management for PHP
  lexik/form-filter-bundle                 v3.0.8             This bundle aim to provide classes to build some form filters and then build a doctrine query from this form filter.
  liuggio/ExcelBundle                      v2.0.4             This is a Symfony2 Bundle helps you to read and write Excel files (including pdf, xlsx, odt), thanks to the PHPExcel li...
  lunetics/locale-bundle                   dev-master 9c10e9b A Bundle for switching Languages
  michelf/php-markdown                     1.6.0              PHP Markdown
  monolog/monolog                          1.17.2             Sends your logs to files, sockets, inboxes, databases and various web services
  nelmio/api-doc-bundle                    2.11.2             Generates documentation for your REST API from annotations
  nikic/php-parser                         v1.4.1             A PHP parser written in PHP
  ocramius/package-versions                1.0.1              Composer plugin that provides efficient querying for installed package versions (no runtime IO)
  ocramius/proxy-manager                   2.0.0              A library providing utilities to generate, instantiate and generally operate with Object Proxies
  paragonie/random_compat                  v1.2.0             PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
  phpcollection/phpcollection              0.4.0              General-Purpose Collection Library for PHP
  phpdocumentor/reflection-docblock        2.0.4              
  phpoffice/phpexcel                       1.8.1              PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine
  phpoption/phpoption                      1.5.0              Option Type for PHP
  phpspec/prophecy                         v1.6.0             Highly opinionated mocking framework for PHP 5.3+
  phpunit/php-code-coverage                2.2.4              Library that provides collection, processing, and rendering functionality for PHP code coverage information.
  phpunit/php-file-iterator                1.4.1              FilterIterator implementation that filters files based on a list of suffixes.
  phpunit/php-text-template                1.2.1              Simple template engine.
  phpunit/php-timer                        1.0.7              Utility class for timing
  phpunit/php-token-stream                 1.4.8              Wrapper around PHP's tokenizer extension.
  phpunit/phpunit                          4.6.10             The PHP Unit Testing framework.
  phpunit/phpunit-mock-objects             2.3.8              Mock Object library for PHPUnit
  psr/log                                  1.0.0              Common interface for logging libraries
  sebastian/comparator                     1.2.0              Provides the functionality to compare PHP values for equality
  sebastian/diff                           1.4.1              Diff implementation
  sebastian/environment                    1.3.3              Provides functionality to handle HHVM/PHP environments
  sebastian/exporter                       1.2.1              Provides the functionality to export PHP variables for visualization
  sebastian/global-state                   1.1.1              Snapshotting of global state
  sebastian/recursion-context              1.0.2              Provides functionality to recursively process PHP variables
  sebastian/version                        1.0.6              Library that helps with managing the version number of Git-hosted PHP projects
  sensio/distribution-bundle               v2.3.22            The base bundle for the Symfony Distributions
  sensio/framework-extra-bundle            v3.0.12            This bundle provides a way to configure your controllers with annotations
  sensio/generator-bundle                  v2.5.3             This bundle generates code for you
  sonata-project/admin-bundle              dev-master e8f3766 Symfony SonataAdminBundle
  sonata-project/block-bundle              2.3.9              Symfony SonataBlockBundle
  sonata-project/cache                     1.0.7              Cache library
  sonata-project/core-bundle               2.3.10             Symfony SonataCoreBundle
  sonata-project/datagrid-bundle           dev-master 0749e71 Symfony SonataDatagridBundle
  sonata-project/doctrine-extensions       1.0.2              Doctrine2 behavioral extensions
  sonata-project/doctrine-orm-admin-bundle dev-master e8eb83f Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
  sonata-project/easy-extends-bundle       2.1.10             Symfony SonataEasyExtendsBundle
  sonata-project/exporter                  1.4.1              Lightweight Exporter library
  sonata-project/google-authenticator      1.0.2              Library to integrate Google Authenticator into a PHP project
  sonata-project/user-bundle               dev-master 8018609 Symfony SonataUserBundle
  stof/doctrine-extensions-bundle          v1.2.2             Integration of the gedmo/doctrine-extensions with Symfony2
  swiftmailer/swiftmailer                  v5.4.1             Swiftmailer, free feature-rich PHP mailer
  symfony/assetic-bundle                   v2.7.1             Integrates Assetic into Symfony2
  symfony/monolog-bundle                   v2.8.2             Symfony MonologBundle
  symfony/polyfill-intl-icu                v1.1.0             Symfony polyfill for intl's ICU-related data and classes
  symfony/polyfill-mbstring                v1.1.0             Symfony polyfill for the Mbstring extension
  symfony/polyfill-php54                   v1.1.0             Symfony polyfill backporting some PHP 5.4+ features to lower PHP versions
  symfony/polyfill-php55                   v1.1.0             Symfony polyfill backporting some PHP 5.5+ features to lower PHP versions
  symfony/polyfill-php56                   v1.1.0             Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
  symfony/polyfill-php70                   v1.1.0             Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
  symfony/polyfill-util                    v1.1.0             Symfony utilities for portability of PHP codes
  symfony/security-acl                     v2.8.0             Symfony Security Component - ACL (Access Control List)
  symfony/swiftmailer-bundle               v2.3.11            Symfony SwiftmailerBundle
  symfony/symfony                          v2.8.2             The Symfony PHP framework
  tecnickcom/tcpdf                         6.2.12             TCPDF is a PHP class for generating PDF documents and barcodes.
  twbs/bootstrap                           v3.3.6             The most popular front-end framework for developing responsive, mobile first projects on the web.
  twig/extensions                          v1.3.0             Common additional features for Twig that do not directly belong in core
  twig/twig                                v1.24.0            Twig, the flexible, fast, and secure template language for PHP
  willdurand/jsonp-callback-validator      v1.1.0             JSONP callback validator.
  willdurand/negotiation                   1.5.0              Content Negotiation tools for PHP provided as a standalone library.
  zendframework/zend-code                  3.0.1              provides facilities to generate arbitrary code using an object oriented interface
  zendframework/zend-eventmanager          3.0.0              Trigger and listen to events within a PHP application
Ocramius commented 8 years ago

Hmm, that is indeed a lot of stuff... Could you gist your composer.json, so I try out things locally?

Tomsgu commented 8 years ago

Yes a lot of stuff... So my composer.json:

"require": {
        "php": ">=5.4",
        "symfony/symfony": "~2.8",
        "doctrine/orm": "~2.2,>=2.2.3,<2.5",
        "doctrine/dbal": "<2.5",
        "doctrine/doctrine-bundle": "~1.2",
        "doctrine/migrations": "dev-master",
        "doctrine/doctrine-migrations-bundle": "dev-master",
        "twig/extensions": "^1.2",
        "symfony/assetic-bundle": "~2.3",
        "symfony/swiftmailer-bundle": "~2.3",
        "symfony/monolog-bundle": "~2.4",
        "sensio/distribution-bundle": "~2.3",
        "sensio/framework-extra-bundle": "~3.0",
        "sensio/generator-bundle": "~2.3",
        "incenteev/composer-parameter-handler": "~2.0",
        "genemu/form-bundle": "~2.2",
        "friendsofsymfony/user-bundle": "~1.3",
        "sonata-project/admin-bundle": "dev-master",
        "sonata-project/doctrine-orm-admin-bundle": "dev-master",
        "sonata-project/user-bundle": "dev-master",
        "sonata-project/datagrid-bundle": "dev-master",
        "liuggio/excelbundle": "~2.0",
        "tecnickcom/tcpdf": "~6.0",
        "knplabs/knp-snappy-bundle": "dev-master",
        "stof/doctrine-extensions-bundle": "~1.2.2",
        "doctrine/doctrine-fixtures-bundle": "2.2.*",
        "beberlei/DoctrineExtensions": "*",
        "twbs/bootstrap": "3.3.*",
        "braincrafted/bootstrap-bundle": "dev-master",
        "jquery/jquery":  "1.10.*",
        "knplabs/knp-paginator-bundle": "~2.4",
        "knplabs/knp-menu-bundle":"dev-master",
        "lexik/form-filter-bundle": "~3.0",
        "jms/translation-bundle": "dev-master",
        "jms/di-extra-bundle": "dev-master",
        "jms/serializer-bundle": "~0.13",
        "lunetics/locale-bundle": "@dev",
        "friendsofsymfony/rest-bundle": "1.3.*",
        "nelmio/api-doc-bundle": "^2.11",
        "phpunit/phpunit": "4.6.*",
        "jeroendesloovere/vcard-bundle": "1.2.*"
    },
    "scripts": {
        "post-install-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Braincrafted\\Bundle\\BootstrapBundle\\Composer\\ScriptHandler::install"
        ],
        "post-update-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Braincrafted\\Bundle\\BootstrapBundle\\Composer\\ScriptHandler::install"
        ]
    },
    "config": {
        "bin-dir": "bin"
    },
    "minimum-stability": "stable",
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        }
    },
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "jquery/jquery",
                "version": "1.10.2",
                "dist": {
                    "url": "http://code.jquery.com/jquery-1.10.2.js",
                    "type": "file"
                }
            }
        }
    ]
Ocramius commented 8 years ago

Oh, that's probably it then: the jquery dist is missing any source information, of course.

Can you try adding a "source": {"reference": "1.10.2"} to the jquery/jquery package (and re-run)?

Tomsgu commented 8 years ago

Unfortunately the problem still persists.

Ocramius commented 8 years ago

Won't be able to check the issue personally in the next days, but please take a look at https://github.com/Ocramius/PackageVersions/blob/56253310fb94b3086fa123f5f3e7ab76723594aa/src/PackageVersions/Installer.php#L189

Tomsgu commented 8 years ago

Thanks for your time anyway, I am trying to find out where can be the problem.

Ocramius commented 8 years ago

@Tomsgu just so you know, that data the script is trying to read comes from the lock file. If you check composer.lock, you should easily spot which item doesn't have a source key

Tomsgu commented 8 years ago

@Ocramius Thank you so much. I found that even when I set source reference for jquery/jquery, it wasn't in a lock file. So you were right in the beginning. After fixing this issue, composer generates the version classes and the original problem doesn't persist anymore.

Sorry, that I post here something that isn't really related with ProxyManager neither PackageVersions.

Ocramius commented 8 years ago

Issue is still valid.

Ocramius commented 8 years ago

Moved to https://github.com/Ocramius/PackageVersions/issues/12 - to be closed here once it is fixed.

garak commented 8 years ago

I'm getting the same fatal error. I'm not using any "repositories" in composer.json, nor I have installed PackageVersion. It looks like composer install is not running any task in the Ocramius namespace. Using Symfony 2.8.4 and ProxyManager 1.0.2

Ocramius commented 8 years ago

@garak this seems to be related to differences in composer install <package name> and just composer install or composer update. I'll ask the composer folks.

Ocramius commented 8 years ago

This is possibly caused by https://github.com/composer/composer/issues/5237

Ocramius commented 8 years ago

This is fixed by composer/composer#5237.

Further fixes to be done in Ocramius/PackageVersions#18