There is the doctrine phpcr-odm layer that maps phpcr repositories to documents. The phpcr layer itself will be mostly relevant to people working on improving the doctrine layer, and maybe for advanced features in the cmf bundles. But for users of the cmf, the phpcr layer is like the sql api – you don’t need to touch it.
Here i will record my experience trying the first Symfony2 CMF based CMS PagesBundle from here:
So before I proceed further I was mentored by dbu some and I decided to first focus on the installation of the jackalope, jackrabbit cr server and phpcrbrowser.
The only issue I had with jackrabbit cr was that i had to run it with a port defined as I was already using jenkins on the same port:
java -jar jackrabbit-standalone-*.jar --port 8888
Then i ran into an error for phpcrbrowser but it was because that had not been updated or synced with the latest developments for jackalope so I had to:
cd ext/jackalope git reset --hard 914c14ade72c9c94c02f269286006c26c98273c9 git submodule update Submodule path 'api-test/suite': checked out '7c0c8d595e2c7247eb2d062fa15c4b5e03f35683' Submodule path 'lib/phpcr': checked out '2eab6944842ddbaa94f9851557001a90e4c79a98'
Then phpcrbrowser was wrought back to life. In addition to this of course i did adjustments for the port and domain for my jackrabbit installation on www/index.php.
Once you are done with jackrabbit and the phpcrbrowser then do not move into tests as it is shown here as the tests for jackalope are not interesting for the cmf and the ones in sandbox are currently broken.
The repository in phpcr is the entry point to get a session as shown in the diagram, the representation of the backend, in phpcr lingo, is the workspace. First we get the repository from the factory configured according certain parameters. Then we use the repository thus created to authenticate by login into the repository. The repository in turn returns to us a session from which we can operate thereby creating nodes, setting its properties, persisting them, and fetching them again for further processing.
1 2 3 4 5 6 7 8 9 10 11 12
$factoryclass = '\Jackalope\RepositoryFactoryJackrabbit'; $parameters = array('jackalope.jackrabbit_uri' => 'http://localhost:8080/server'); //end of implementation specific configuration $factory = new $factoryclass(); $repository = $factory->getRepository($parameters); $credentials = new \PHPCR\SimpleCredentials('admin','admin'); $session = $repository->login($credentials, 'default); $node = $session->addNode('test', 'nt:unstructured'); $node->setProperty('prop', 'value'); $session->save(); ... $node = $session->getNode('/test'); echo $node->getPropertyValue('prop');
Ok so after a rapid intro to some phpcr code, we now turn to start with the cmf-sandbox. The cmf-sandbox is the test project that tries to demo the integration for all the phpcr components for a symfony2 project.
We now setup the project, register node types for phpcr and load fixtures:
git clone git://github.com/symfony-cmf/cmf-sandbox.git cd cmf-sandbox bin/vendors install cp app/config/parameters.ini.dist app/config/parameters.ini gedit app/config/parameters.ini bin/vendors update app/console doctrine:phpcr:register-system-node-types app/console -v phpcr:fixtures:load --path=src/Sandbox/MainBundle/Resources/data/fixtures/ --purge=true
Because the documentation I saw on github told me to play adding or populating some info on my jackrabbit server I did and now I am getting this error while loading the fixtures:
[PHPCR\PathNotFoundException] HTTP 404 Path Not Found: DELETE array ( '/edu' => 'http://localhost:8888/server/default/jcr:root/edu', )
and now trying to do a purge stuck on this:
[ErrorException] Notice: Undefined property: Symfony\Cmf\Bundle\PhpcrCommandsBundle\Command\PurgeCommand::$container in /home/cordoval/sites-2/cmf-sandbox/vendor/symfony-cmf/src/Symfony/Cmf/Bundle/PhpcrCommandsBundle/Command/PhpcrCommand.php line 38
There was another problem that I resolved by shutting down the java process and removing the jackrabbit subfolder that gets generated by the server.
Also make sure you have to place your vhost folder to be served starting at the cmf-symfony/web level, else you will have problems with loading the css and other assets files.
What is the next step?
Try to work on this issues here and help us with the symfony2 cmf effort: