> > In theory, it should be possible to set the manager_name either way
> > around, and then override it in the other cases.
>
> ack. if you set it before any of the routing happens, it does not matter
> which is the default as long as you catch all non-default cases.
> i would feel more safe to have the published workspace be the default.
>
>
> I guess it depends which is the biggest danger in the event of a coding
> error: accidentally modifying the published content, or accidentally
> revealing the preview content.
>
> I will probably try to use the most common case as the default, but it's
> not clear which one is most common yet.
i would tend to leave the default on the published, so all bundles that
might read and whatever do not need to know at all.
writing is quite contained so should be easier to be sure it always goes
to the right workspace.
> I always had the controller configured on the routes, not the pages. Not
> sure if that's the best way or not. Here is how my routes are created in
> the fixtures:
>
> $route = new Route();
> $route->setPosition($parentNode, $newNodeName);
> $route->setDefault('_controller', 'PwnContentViewBundle:Default:index');
> $route->setRouteContent($sourceNode);
> $this->manager->persist($route);
> $this->manager->flush();
ah then really its most likely the mapping pass issue you are seeing.
i much prefer configuring the controller (or template if i need no
specific controller) in the bundle config by content document class. its
much easier to fix if you for example refactor a name. if the name is
stored in the db, you might not refactor because you don't want to
migrate the data, leaving your application less understandable than it
otherwise would be...
> Where is the manager specified in the current mappings? I could find the
> part where the manager name is used (from the config item
> "cmf_routing.manager_name"). Is there any mention of the manager in the
> XML mappings, or elsewhere?
>
> Assuming I can figure out the mappings above, is it safe to have two
> compiler passes? I would not want a route from the preview workspace to
> be picked up if there is no matching route in published, or anything
> like that.
i'll try to explain. the mapping pass has nothing at all to do with
routing. when phpcr-odm loads documents, it needs metadata. the mapping
pass is used to tell doctrine where to find that.
the compiler pass does not add the information to all doctrine manager
instances, but only to one. when you look at the CmfRoutingBundle bundle
class, you see how we instantiate the compiler pass for the base routing
class. we pass it cmf_routing.manager_name to find the manager - you can
see this name in DependencyInjection\Configuration.php - if that is not
defined, we fall back to the param that defines the global default
manager name of phpcr-odm.
you can safely create another compiler pass where you pass the name of a
parameter that tells the manager name for the draft workspace. then the
draft thing should persist route defaults and parameters as well.
note that right now we are only talking about the mapping for the base
Symfony\Component\Routing but i plan to move the Route document to Model
and then use the compiler pass also for the
Symfony\Cmf\Bundle\RoutingBundle\Model\Route class.
cheers,david
--
Liip AG // Agile Web Development // T
+41 26 422 25 11
CH-1700 Fribourg // PGP 0xA581808B //
www.liip.ch