title: JMS Serializer ignored my YML Entity exclusions
body: <p>My config is</p>
  
  <pre><code>jms_serializer:
      metadata:
          auto_detection: true
          directories:
              NameOfBundle:
                  namespace_prefix: ""
                  path: "@VendorNameOfBundle/Resources/config/serializer"
  </code></pre>
  
  <p>My YML file named <code>Entity.Project.yml</code> contains</p>
  
  <pre><code>Vendor\NameOfBundle\Entity\Project:
      exclusion_policy: ALL
      properties:
          id:
              expose: true
  </code></pre>
  
  <p>I am loading the serializer like so from within a Controller</p>
  
  <pre><code>$serializer = SerializerBuilder::create()
      -&gt;configureListeners(function(EventDispatcher $dispatcher) {
          $dispatcher-&gt;addSubscriber(new ProjectSubscriber($this-&gt;container));
      })
      -&gt;addDefaultListeners()
      -&gt;build();
  </code></pre>
  
  <p>This completely ignored my YML file and exposes all fields from the Project. I have cleared the cache.</p>
  
  <p>But if I use this instead without the custom subscriber, then the exclusions work</p>
  
  <pre><code> $serializer = $this-&gt;get("jms_serializer");
  </code></pre>
  
  <p>Even explicitly adding a dir does not work either</p>
  
  <pre><code>$serializer = SerializerBuilder::create()
      -&gt;configureListeners(function(EventDispatcher $dispatcher) {
          $dispatcher-&gt;addSubscriber(new ProjectSubscriber($this-&gt;container));
      })
      -&gt;addDefaultListeners()
      -&gt;addMetadataDir(realpath($this-&gt;get('kernel')-&gt;getRootDir()."/../") . '/src/Vendor/NameOfBundle/Resources/config/serializer')        
      -&gt;build();
  </code></pre>
  
  <p>The docs are not clear on how this path should befined. The above method does not error, but does not pull in the YML files. The below method errors and says the directory does not exist;</p>
  
  <pre><code>$serializer = SerializerBuilder::create()
      -&gt;configureListeners(function(EventDispatcher $dispatcher) {
          $dispatcher-&gt;addSubscriber(new ProjectSubscriber($this-&gt;container));
      })
      -&gt;addDefaultListeners()
      -&gt;addMetadataDir('@VendorNameOfBundle/Resources/config/serializer')
      -&gt;build();
  </code></pre>
  
  <p>How do I make the JMS Serializer look at my YML file in order to exclude the fields and also use the Subscriber?</p>