JMS Serializer ignored my YML Entity exclusions JMS Serializer ignored my YML Entity exclusions symfony symfony

JMS Serializer ignored my YML Entity exclusions


As i see from documentation you need to setup your Yaml files:

it is necessary to configure a metadata directory where those files are located:

$serializer =    JMS\Serializer\SerializerBuilder::create()        ->addMetadataDir($someDir)        ->build();

For more information read manual.


This was helpful Using JMSSerialize to serialize Doctrine2 Entities that follow SimplifiedYamlDriver convention

It would appear that the file names needs to be completely different if you do not specify a namespace. I never thought to specify a namespace as this is not mentioned in the main docs.

If there is no namespace then the addMetaDir usage is fine but you also need to make sure your file names look like this

Vendor.NameOfBundle.Entity.Project.yml