Search code examples
phpsymfonydoctrinesymfony-cmf

How to "doctrine:phpcr:repository:init" in PHP


How can I execute this code

php app/console doctrine:phpcr:repository:init

from PHP?

I want to manually initialize the repository from tests (PHPUnit) but I'm not sure what way to do it. How can I do this from PHP?


Solution

  • Generally the init command does 2 things: 1) register the default system node types 2) load initializers from Bundles

    For 1) this only really needs to be done for a repository, ie. it does not need to be done for each workspace, so all that needs to be done is 2)

    Here I would recommend to have a look at the CMF SE or the sandbox. In general I would recommend creating a new workspace for testing and then using fixtures to generate the required data structure.