Bug #55309

PackageManager::getPackageOfObject() does not work for proxy objects

Added by Bastian Waidelich over 7 years ago. Updated about 7 years ago.

Status:
Resolved
Priority:
Should have
Category:
Package
Target version:
-
Start date:
2014-01-24
Due date:
% Done:

100%

Estimated time:
PHP Version:
Has patch:
No
Complexity:

Description

The method PackageManager::getPackageOfObject() fails to resolve the package of a given object if it's a proxy.

The Flow/Doctrine proxy classes usually reside in a folder underneath Data/Temporary. Comparing those paths with the package root paths leads to invalid results.


Related issues

Related to TYPO3.Flow - Bug #50118: Add a method in the PackageManager to get package of class nameResolvedDominique Feyer2013-07-17

Actions
#1

Updated by Gerrit Code Review over 7 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.Flow has been pushed to the review server.
It is available at https://review.typo3.org/27045

#2

Updated by Gerrit Code Review over 7 years ago

Patch set 2 for branch master of project Packages/TYPO3.Flow has been pushed to the review server.
It is available at https://review.typo3.org/27045

#3

Updated by Bastian Waidelich over 7 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#4

Updated by Gerrit Code Review over 7 years ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch 2.0 of project Packages/TYPO3.Flow has been pushed to the review server.
It is available at https://review.typo3.org/27186

#5

Updated by Gerrit Code Review over 7 years ago

Patch set 1 for branch 2.1 of project Packages/TYPO3.Flow has been pushed to the review server.
It is available at https://review.typo3.org/27187

#6

Updated by Adrian Föder over 7 years ago

The current implementation is still not fully well-working; now it only regards the namespace no matter where the class actually lies.
This might lead to unexpected results; already for the Migration classes which have a TYPO3\Flow namespace, but lie in a respective package of course.

TBH I think the initial implementation where the actual class location was determined, was generally the approach which more matched the expectation of the functionality; but of course with the drawback of Proxy classes not working since they live in Data/Temporary; so I think in case of proxy classes it should manually be worked around (to the least by checking instanceof \TYPO3\Flow\Object\Proxy\ProxyInterface and then taking the Namespace into account, because then it's definitely a Flow package class lying in its PSR-0 location etcpp.)

So my suggestion / opinion so far is: building it back to detecting the actual file location; and only if it seems to be a (copied) Proxy, use the NS as package determinator.

#7

Updated by Dominique Feyer over 7 years ago

Adrian Föder: I agree +1

#8

Updated by Bastian Waidelich over 7 years ago

Good points! I'll try to push a follow up today! But I doubt that we should fall back to NS / path, it should be the one or the other.. I'm sure there is a way to find the original class from the proxy

#9

Updated by Gerrit Code Review over 7 years ago

Patch set 2 for branch 2.1 of project Packages/TYPO3.Flow has been pushed to the review server.
It is available at https://review.typo3.org/27187

#10

Updated by Gerrit Code Review over 7 years ago

Patch set 2 for branch 2.0 of project Packages/TYPO3.Flow has been pushed to the review server.
It is available at https://review.typo3.org/27186

#11

Updated by Bastian Waidelich about 7 years ago

  • Status changed from Under Review to Resolved

Also available in: Atom PDF