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

Lazy services with factories #118

Closed
metanav opened this Issue May 12, 2016 · 5 comments

Comments

Projects
None yet
2 participants
@metanav

metanav commented May 12, 2016

I am using a lazy service but I guess proxy is not being generated correctly. Or, I am missing some basic things. I have created a gist: https://gist.github.com/metanav/0017ee8b3171e079be2fc165ccf69ac9

@Ocramius

This comment has been minimized.

Show comment
Hide comment
@Ocramius

Ocramius May 12, 2016

Member

What is the outcome? Btw, the class map seems incorrect: should map from
service name to expected instance type, not to factories.
On May 12, 2016 18:03, "Naveen" notifications@github.com wrote:

I am using a lazy service but I guess proxy is not being generated
correctly. Or, I am missing some basic things. I have created a gist:
https://gist.github.com/metanav/0017ee8b3171e079be2fc165ccf69ac9


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#118

Member

Ocramius commented May 12, 2016

What is the outcome? Btw, the class map seems incorrect: should map from
service name to expected instance type, not to factories.
On May 12, 2016 18:03, "Naveen" notifications@github.com wrote:

I am using a lazy service but I guess proxy is not being generated
correctly. Or, I am missing some basic things. I have created a gist:
https://gist.github.com/metanav/0017ee8b3171e079be2fc165ccf69ac9


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#118

@metanav

This comment has been minimized.

Show comment
Hide comment
@metanav

metanav May 12, 2016

it throws the error:
Fatal error: Call to undefined method ProxyManagerGeneratedProxy__PM__\SocialAuth\Adapter\Factory\HybridAuthAdapterFactory\Generatedc168519a10309fef32fc623cefbfddd3::authenticate()

I have modified the class_map (see the updated gist) and seems working. Just wondering how the proxy manager calls the factory and inject dependencies to the instance?

metanav commented May 12, 2016

it throws the error:
Fatal error: Call to undefined method ProxyManagerGeneratedProxy__PM__\SocialAuth\Adapter\Factory\HybridAuthAdapterFactory\Generatedc168519a10309fef32fc623cefbfddd3::authenticate()

I have modified the class_map (see the updated gist) and seems working. Just wondering how the proxy manager calls the factory and inject dependencies to the instance?

@metanav

This comment has been minimized.

Show comment
Hide comment
@metanav

metanav May 12, 2016

Also, how to know whether the generated proxy can call the real object? Suppose for some reason real object creation gets failed due to some exception and it is set as null in proxy. How can be checked if it is null?

metanav commented May 12, 2016

Also, how to know whether the generated proxy can call the real object? Suppose for some reason real object creation gets failed due to some exception and it is set as null in proxy. How can be checked if it is null?

@Ocramius

This comment has been minimized.

Show comment
Hide comment
@Ocramius

Ocramius May 13, 2016

Member

I have modified the class_map (see the updated gist) and seems working.

So the issue is fixed?

Just wondering how the proxy manager calls the factory and inject dependencies to the instance?

That is a bit more advanced: you will need to read the ProxyManager documentation. You can also read further in https://github.com/Ocramius/ProxyManager/tree/2.0.1/docs

Also, how to know whether the generated proxy can call the real object? Suppose for some reason real object creation gets failed due to some exception and it is set as null in proxy. How can be checked if it is null?

This is a very good point, and I don't think that ProxyManager provides any utility to check that at the moment. Could you open an issue on ProxyManager with a possible failure scenario (once you caught up on the docs for it)?

Member

Ocramius commented May 13, 2016

I have modified the class_map (see the updated gist) and seems working.

So the issue is fixed?

Just wondering how the proxy manager calls the factory and inject dependencies to the instance?

That is a bit more advanced: you will need to read the ProxyManager documentation. You can also read further in https://github.com/Ocramius/ProxyManager/tree/2.0.1/docs

Also, how to know whether the generated proxy can call the real object? Suppose for some reason real object creation gets failed due to some exception and it is set as null in proxy. How can be checked if it is null?

This is a very good point, and I don't think that ProxyManager provides any utility to check that at the moment. Could you open an issue on ProxyManager with a possible failure scenario (once you caught up on the docs for it)?

@Ocramius

This comment has been minimized.

Show comment
Hide comment
@Ocramius

Ocramius May 13, 2016

Member

Closing here, since the question turned out to be a misconfiguration issue.

Member

Ocramius commented May 13, 2016

Closing here, since the question turned out to be a misconfiguration issue.

@Ocramius Ocramius closed this May 13, 2016

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