Skip to content

Instantly share code, notes, and snippets.

@digitalkaoz
Last active August 29, 2015 14:07
Show Gist options
  • Save digitalkaoz/90644937a322b3739bd2 to your computer and use it in GitHub Desktop.
Save digitalkaoz/90644937a322b3739bd2 to your computer and use it in GitHub Desktop.
serializer for external classes
# app/config/config.yml
jms_serializer:
metadata:
directories:
my-file:
namespace_prefix: "My\\Ns"
path: "@MyNsBundle/Resources/config/serializer"
<?php
// My/Ns/File
namespace My\Ns;
class File
{
}
<!-- My/Ns/Bundle/Resources/config/serializer/My.Ns.File.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<serializer>
<class name="My\Ns\File" exclusion-policy="ALL">
</class>
</serializer>
@digitalkaoz
Copy link
Author

got it working:

jms_serializer:
    metadata:
        directories:
            issues:
                namespace_prefix: "Rs\\Issues"
                path: "@RsIssuesBundle/Resources/config/serializer/issues"
 ls -la vendor/digitalkaoz/issues-bundle/Resources/config/serializer/issues
Github.GithubIssue.xml
Github.GithubProject.xml
<?xml version="1.0" encoding="UTF-8" ?>
<serializer>
    <class name="Rs\Issues\Github\GithubProject" exclusion-policy="ALL">
    <!-- ... -->
    </class>

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