-
Notifications
You must be signed in to change notification settings - Fork 2
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
Generate Access Interceptor Proxy #43
base: master
Are you sure you want to change the base?
Conversation
Issued by Coverage Checker: |
public function generate(\ReflectionClass $originalClass, ClassGenerator $classGenerator, array $proxyOptions = []) | ||
{ | ||
if (!\array_key_exists('methods', $proxyOptions)) { | ||
throw new \InvalidArgumentException(sprintf('Generator %s needs a methods proxyOptions', __CLASS__)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw new \InvalidArgumentException(sprintf('Generator %s needs a methods proxyOptions', __CLASS__)); | |
throw new \InvalidArgumentException(sprintf('Generator %s needs a property "methods" in proxyOptions', __CLASS__)); |
also I'm not sure what you meant with this errors, that the array proxyOptions
must have a key 'methods' in it or if the key 'methods' doesn't exist in the array, the Generator class that extends this one must have a method "getProxyOptions()" or something similare ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
proxyOptions must have a "methods" key
$factoryDefinition->setTags($definition->getTags()); | ||
|
||
if ($definition->getFactory() !== null) { | ||
$this->compiler->log($this, "Service {$taggedServiceName} is not compatible with service proxy"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make an error
{ | ||
foreach ($this->proxies as $proxy) { | ||
if ($proxy instanceof LazyLoadingInterface && !$proxy->isProxyInitialized()) { | ||
$proxy->initializeProxy(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add continue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is LazyLoadingInterface doesn't exist
{ | ||
$instanceRef = new \ReflectionObject($object); | ||
$methods = $instanceRef->getMethods(\ReflectionMethod::IS_PUBLIC); | ||
$instanceRef = new \ReflectionClass($class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
although scanning all methods of a class permits us to throw errors on decorated private methods, the cost of loading annotation for each method maybe high in dev env
a1e73ed
to
48b6ea4
Compare
Time to open this PR.
Main change: remove the value holder proxy to create an extended class with the interceptor.
This fix some bug and limitation and add another bunch of limitation.
Removed limitations:
New limitations:
Also this PR add a few errors when an impossible operation is asked and add a cache warmer to generate proxies.
I kept the term proxy but is not a proxy anymore ;-)