ninethousand/NineThousandJobqueueBundle — Issue #6: Can't create Job via JobAdapter
Author: saem
Created: 2011-11-19 23:49:16+00:00
State: open

Following the example as provided in the [gist](https://gist.github.com/1154182), I can't add a new job to a queue. Upon creation of the JobAdapter (line 16), the constructor call calls the JobAdapter::getType method, which does an EntityManager::refresh on the JobEntity. This throws an Entity not managed by EntityManager exception.

I've done some basic poking around, such as query the provided entity manager to ensure that the Jobqueue bundle class metadata is in fact present and therefore this isn't a wiring problem. Persisting the entity via the entity manager prior to passing it in causes other issues, but as stated in the documentation this is not recommended. At this point I'm not sure what to do.

I don't believe refreshes are meant to be called in this fashion at all, as per the Doctrine documentation, as the API docs clearly state that this first resets the state of the entity based on the values from the database. At first blush, the code doesn't make sense.