Feature #34783

Provide utility method to get unproxied class name

Added by Adrian Föder over 3 years ago. Updated over 3 years ago.

Status:Closed Start date:2012-03-13
Priority:Should have Due date:
Assigned To:- % Done:

0%

Category:Persistence
Target version:-
PHP Version: Complexity:
Has patch:No

Description

In some cases, get_class($object) returns the Doctrine proxy class; and not the actual, intended class name.

In Doctrine itself, there is a method Doctrine\Common\Util\ClassUtils...

1   /**
2     * Get the real class name of an object (even if its a proxy)
3     *
4     * @param object
5     * @return string
6     */
7    public static function getClass($object)

which basically does some str_replace; unfortunately it doesn't work with FLOW3 proxies due to a different naming scheme.

A possibility is to provide a method that

1if ($object instanceof \Doctrine\ORM\Proxy\Proxy) {
2   return get_parent_class($object);
3}

but that's probably not very clean.

So, a reliable method to achieve that should be provided by FLOW3.


Related issues

duplicates TYPO3.Flow - Task #34426: How to receive the correct class name for an object? Resolved 2012-02-29

History

#1 Updated by Adrian Föder over 3 years ago

  • Status changed from New to Closed

Closed due to duplicity to #34426...

Also available in: Atom PDF