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

Missing doctrine/common in composer.json #1745

Closed
Ahummeling opened this issue Jan 23, 2024 · 0 comments · Fixed by #1747
Closed

Missing doctrine/common in composer.json #1745

Ahummeling opened this issue Jan 23, 2024 · 0 comments · Fixed by #1747

Comments

@Ahummeling
Copy link

Ahummeling commented Jan 23, 2024

This project has a dependency on doctrine/common in the Bundle class (DoctrineBundle). It uses the ClassUtils.
As far as I can see, because doctrine/orm required doctrine/common up until 3.0, it was always installed and it was never a problem. But, when upgrading doctrine/orm to ithe 3.0-beta.2 version (to try and find some bugs to work on :p) I found that my project no longer worked.

The offending line is at DoctrineBundle:104:

$originalClassName = ClassUtils::getRealClass($class);

Which is found in DoctrineBundle::boot`. The context here is (I believe) auto-loading a class for which we want to generate a proxy class.

With ClassUtils::getRealClass looking as follows:

/**
     * Gets the real class name of a class name that could be a proxy.
     *
     * @param string $className
     * @psalm-param class-string<Proxy<T>>|class-string<T> $className
     *
     * @return string
     * @psalm-return class-string<T>
     *
     * @template T of object
     */
    public static function getRealClass($className)
    {
        $pos = strrpos($className, '\\' . Proxy::MARKER . '\\');

        if ($pos === false) {
            /** @psalm-var class-string<T> */
            return $className;
        }

        return substr($className, $pos + Proxy::MARKER_LENGTH + 2);
    }

So the naive solution would be to add doctrine/common to the composer.json file.
An alternative solution would be to extract the necessary feature from the doctrine/common package, and put it in this project.

I remember something about deprecating something in a doctrine common namespace a few years ago, and I am not sure if the common library is in the process of being phased out. If this is the case, the alternative solution would obviously take preference, as the method in question is quite simple.

I've made a PR (#1746 ) for the naive solution. If another solution is desired, I would also be happy to work on that. Please let me know.

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

Successfully merging a pull request may close this issue.

1 participant