symfony-cmf/cmf-sandbox — Issue #27: Purge command/fixtures problem
Author: kostiklv
Created: 2011-10-22 12:44:10+00:00
State: open

While installing the cmf-sandbox I've noticed two issues:

1. The command for importing fixtures doesn't work with --purge option
app/console -v doctrine:phpcr:fixtures:load --path=src/Sandbox/MainBundle/Resources/data/fixtures/ --purge=true

The problem is that it's trying to purge the "/rep:policy" node, which seems to be a system node. It throws [PHPCR\NodeType\ConstraintViolationException]
HTTP 409: Unable to perform operation. Node is protected

While debugging, I tried to use doctrine:phpcr:purge command to test purging. It also didn't work. I've fixed that by changing isSystemNode method in NodeHelper to the following:

return preg_match('/^(jcr|rep):/', $node->getName());

The doctrine:phpcr:purge started to work.

2. It turned out that the doctrine:phpcr:fixtures:load command with --purge option use a separate implementation of purge, found in PHPCRPurger class. Seems like it should be refactored to use NodeHelper.