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

Proxy name should be differentiated based on the proxy capabilities #10

Closed
Ocramius opened this issue Mar 24, 2013 · 1 comment · Fixed by #59
Closed

Proxy name should be differentiated based on the proxy capabilities #10

Ocramius opened this issue Mar 24, 2013 · 1 comment · Fixed by #59
Assignees
Milestone

Comments

@Ocramius
Copy link
Owner

A proxy class intercepting doFoo and a proxy class intercepting doBar should have different naming to avoid collisions. Same applies for different proxy types. The naming strategies should be tweaked to handle this.

@Ocramius
Copy link
Owner Author

Currently, this affects also co-existing proxies coming from different factories.

For example, following code will cause an exception:

<?php

require __DIR__ . '/../vendor/autoload.php';

class Track
{
}

$config   = new \ProxyManager\Configuration();
$factory  = new \ProxyManager\Factory\HydratorFactory($config);
$hydrator = $factory->createProxy('Track');
$config  = new \ProxyManager\Configuration();
$factory = new \ProxyManager\Factory\AccessInterceptorValueHolderFactory($config);
$proxy   = $factory->createProxy(
    new Track,
    array('getProject' => function () { echo "Query completed!\n"; }),
    array('getProject' => function () { echo "Query completed!\n"; })
);

That happens because the hydrator is generated and then re-used immediately in the second factory instead of an access interceptor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant