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

Hooking into metadata directly... #17

Closed
j opened this issue Jan 1, 2013 · 2 comments
Closed

Hooking into metadata directly... #17

j opened this issue Jan 1, 2013 · 2 comments

Comments

@j
Copy link

j commented Jan 1, 2013

I'm writing a library right now and was wondering what is the best way of declaring a class/metadata file as serializable. In my library, I'm suggesting to install the serializer, but it's not installed by default.

So to ask my question simply:

What's the best way of defining metadata without forcing users to just add the directory I provide....

I'd like to be able to do something like,

$j = (new MyBuilder())
    ->attachSerializer($jmsSerializer)
    ->build();

and then my library is in charge of defining where my class metadata lies, etc.

Granted, if this is a Symfony2 bundle instead of a library, this is easy to do, but it's not.

I may be over thinking this.... maybe a break from a computer will help. 👅

Let me know if you know of the best solution.

@schmittjoh
Copy link
Owner

If you pass the builder instead of the serializer, you should be able to set the directory.

$j = (new MyBuilder())
       ->attachSerializerBuilder($jmsSerializerBuilder)
       ->build();

Another approach could be to allow classes to define metadata via a static method (we would need a new metadata driver for this).

@j
Copy link
Author

j commented Jan 1, 2013

Okay, I'll play with it. Don't see you on irc much and know issues is a bad way to communicate, haha. Closing this issue.

@j j closed this as completed Jan 1, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants