diff --git a/book/installation.rst b/book/installation.rst index 30960c41..f26fedbb 100644 --- a/book/installation.rst +++ b/book/installation.rst @@ -60,7 +60,7 @@ and then get the Symfony CMF code with it (this may take a while): .. code-block:: bash - $ php composer.phar create-project symfony-cmf/standard-edition ~1.1 + $ composer create-project symfony-cmf/standard-edition ~1.2 $ cd .. note:: @@ -76,7 +76,7 @@ to configure the permissions and then run the ``install`` command: .. code-block:: bash - $ php composer.phar install + $ composer install 2) GIT ~~~~~~ @@ -94,7 +94,7 @@ dependencies, use the ``install`` command: .. code-block:: bash - $ php composer.phar install + $ composer install Set up the Database diff --git a/book/routing.rst b/book/routing.rst index 18ddc868..5d6295cb 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -453,6 +453,7 @@ follows:: use Doctrine\Common\Persistence\ObjectManager; use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\Route; use Symfony\Cmf\Bundle\ContentBundle\Doctrine\Phpcr\StaticContent; + use PHPCR\Util\NodeHelper; class LoadRoutingData implements FixtureInterface { @@ -461,6 +462,13 @@ follows:: */ public function load(ObjectManager $dm) { + if (!$dm instanceof DocumentManager) { + $class = get_class($dm); + throw new \RuntimeException("Fixture requires a PHPCR ODM DocumentManager instance, instance of '$class' given."); + } + + NodeHelper::createPath($session, '/cms/routes'); + $route = new Route(); $route->setParentDocument($dm->find(null, '/cms/routes')); $route->setName('projects'); @@ -486,6 +494,15 @@ follows:: This will give you a document that matches the URL ``/projects/`` but also ``/projects`` as there is a default for the id parameter. +.. caution:: + + As you can see, the code explicitely creates the ``/cms/routes`` path. + The RoutingBundle only creates this path automatically if the Sonata Admin + was enabled in the routing configuration using an :ref:`initializer + `. Otherwise, it'll assume you do + something yourself to create the path (by configuring an initializer or + doing it in a fixture like this). + Because you defined the ``{id}`` route parameter, your controller can expect an ``$id`` parameter. Additionally, because you called setRouteContent on the route, your controller can expect the ``$contentDocument`` parameter. diff --git a/book/simplecms.rst b/book/simplecms.rst index 466c751e..4d2427d2 100644 --- a/book/simplecms.rst +++ b/book/simplecms.rst @@ -61,6 +61,11 @@ To create a page, use the */ public function load(ObjectManager $dm) { + if (!$dm instanceof DocumentManager) { + $class = get_class($dm); + throw new \RuntimeException("Fixture requires a PHPCR ODM DocumentManager instance, instance of '$class' given."); + } + $parent = $dm->find(null, '/cms/simple'); $page = new Page(); $page->setTitle('About Symfony CMF'); @@ -111,6 +116,11 @@ structure, you would do:: */ public function load(ObjectManager $dm) { + if (!$dm instanceof DocumentManager) { + $class = get_class($dm); + throw new \RuntimeException("Fixture requires a PHPCR ODM DocumentManager instance, instance of '$class' given."); + } + $root = $dm->find(null, '/cms/simple'); $about = new Page(); diff --git a/bundles/content/exposing_content_via_rest.rst b/bundles/content/exposing_content_via_rest.rst index 532c2de7..c06bc668 100644 --- a/bundles/content/exposing_content_via_rest.rst +++ b/bundles/content/exposing_content_via_rest.rst @@ -43,7 +43,7 @@ Then use Composer_ to update your projects vendors: .. code-block:: bash - $ php composer.phar update + $ composer update Configuring FOSRestBundle ------------------------- diff --git a/bundles/core/dependency_injection_tags.rst b/bundles/core/dependency_injection_tags.rst index a4e76903..c09bef09 100644 --- a/bundles/core/dependency_injection_tags.rst +++ b/bundles/core/dependency_injection_tags.rst @@ -4,33 +4,6 @@ Dependency Injection Tags ------------------------- -cmf_request_aware -~~~~~~~~~~~~~~~~~ - -.. caution:: - - This tag has been deprecated in CoreBundle 1.1 and will be removed - in CoreBundle 1.2. Since Symfony 2.3, you can profit from the fact - that the request is a `synchronized service`_. - -When working with the 1.0 version of the CMF in Symfony 2.2 and you have -services that need the request (e.g. for the publishing workflow or current -menu item voters), you can tag services with ``cmf_request_aware`` to have a -kernel listener inject the request. Any class used in such a tagged service -must have the ``setRequest`` method or you will get a fatal error:: - - use Symfony\Component\HttpFoundation\Request; - - class MyClass - { - private $request; - - public function setRequest(Request $request) - { - $this->request = $request; - } - } - cmf_published_voter ~~~~~~~~~~~~~~~~~~~ diff --git a/bundles/create/configuration.rst b/bundles/create/configuration.rst index c5ee8e96..c6628c57 100644 --- a/bundles/create/configuration.rst +++ b/bundles/create/configuration.rst @@ -85,6 +85,7 @@ persistence configuration has the following configuration: model_class: ~ controller_class: Symfony\Cmf\Bundle\CreateBundle\Controller\ImageController basepath: /cms/media + delete: false .. code-block:: xml @@ -95,6 +96,7 @@ persistence configuration has the following configuration: 'Symfony\Cmf\Bundle\CreateBundle\Controller\ImageController', 'basepath' => '/cms/media', ), + 'delete' => false, ), ), )); @@ -152,6 +155,14 @@ provided by the MediaBundle. If you need different image handling, you can either overwrite ``model_class`` and/or the ``controller_class``. +delete +"""""" +**type**: ``boolean`` **default**: ``false`` + +Set delete to true to enable the simple delete workflow. This allows to directly +delete content from the frontend. Be careful, there are no special checks once you confirm deletion +your content is gone. + Metadata Handling ~~~~~~~~~~~~~~~~~ @@ -208,7 +219,17 @@ REST handler ~~~~~~~~~~~~ You can configure the REST handler class with the ``rest_controller_class`` -option. +option. Furthermore it is possible to enable ``rest_force_request_locale``. +When this option is enabled, the current request locale is set on the model +instance. This is useful in order to automatically translate a model to +the request locale when using inline editing, instead of editing the model +in the locale in which it is currently stored, which might be different +than the request locale due to language fallback. + +.. note:: + + The ``rest_force_request_locale`` option requires that the + :doc:`CoreBundle <../core/introduction>` is enabled. Editor configuration ~~~~~~~~~~~~~~~~~~~~ diff --git a/bundles/create/introduction.rst b/bundles/create/introduction.rst index 7f5553b0..2864c376 100644 --- a/bundles/create/introduction.rst +++ b/bundles/create/introduction.rst @@ -117,16 +117,22 @@ overwrite them) are: { "extra": { - "create-directory": "vendor/symfony-cmf/create-bundle/Symfony/Cmf/Bundle/CreateBundle/Resources/public/vendor/create", + "create-directory": "vendor/symfony-cmf/create-bundle/Resources/public/vendor/create", "create-repository": "https://github.com/bergie/create.git", "create-commit": "a148ce9633535930d7b4b70cc1088102f5c5eb90" - "ckeditor-directory": "vendor/symfony-cmf/create-bundle/Symfony/Cmf/Bundle/CreateBundle/Resources/public/vendor/ckeditor", + "ckeditor-directory": "vendor/symfony-cmf/create-bundle/Resources/public/vendor/ckeditor", "ckeditor-repository": "https://github.com/ckeditor/ckeditor-releases.git", "ckeditor-commit": "bba29309f93a1ace1e2e3a3bd086025975abbad0" } } +.. versionadded:: 1.2 + The Symfony CMF bundles updated to PSR-4 autoloading with Symfony CMF + 1.2. Before, the target directories were located in the + ``vendor/symfony-cmf/create-bundle/Symfony/Cmf/Bundle/CreateBundle/Resources/public/vendor`` + directory. + Add this bundle (and its dependencies, if they are not already added) to your application's kernel:: @@ -250,6 +256,11 @@ routing configuration to enable the REST end point for saving content: $collection->addCollection($loader->import("@CmfCreateBundle/Resources/config/routing/rest.xml")); return $collection; + +.. tip:: + + If you don't want these routes to be prefixed by the current locale, you can + use the ``@CmfCreateBundle/Resources/config/routing/rest_no_locale.xml`` file instead. If you have the :doc:`MediaBundle <../media/index>` present in your project as well, you additionally need to register the route for the image upload handler: @@ -500,7 +511,7 @@ Mapping Requests to Domain Objects One last piece is the mapping between CreatePHP data and the application domain objects. Data needs to be stored back into the database. -In version 1.0, the CreateBundle only provides a service to map to Doctrine +Currently, the CreateBundle only provides a service to map to Doctrine PHPCR-ODM. If you do not enable the phpcr persistence layer, you need to configure the ``cmf_create.object_mapper_service_id``. @@ -513,6 +524,66 @@ configure the ``cmf_create.object_mapper_service_id``. CreatePHP would support specific mappers per RDFa type. If you need that, dig into the CreatePHP and CreateBundle and do a pull request to enable this feature. +Workflows +--------- + +.. versionadded:: 1.1 + Support for workflows was introduced in CreateBundle 1.1. + +CreateJS uses a REST api for creating, loading and changing content. To delete content +the HTTP method DELETE is used. Since deleting might be a more complex operation +than just removing the content form the storage (e.g. getting approval by another +editor) there is no simple delete button in the user frontend. Instead, CreateJS and +CreatePHP use "workflows" to implement that. This bundle comes with a simple implementation +of a workflow to delete content. To enable the workflow set the config option 'delete' to true. + +.. configuration-block:: + + .. code-block:: yaml + + cmf_create: + persistence: + phpcr: + delete: true + + .. code-block:: xml + + + + + + + + + + + + .. code-block:: php + + $container->loadFromExtension('cmf_create', array( + 'persistence' => array( + 'phpcr' => array( + 'delete' => true, + ), + ), + )); + +This results in the delete workflow being registered with CreatePHP and CreateJS so that +you can now delete content from the frontend. + +.. note:: + + The provided workflow supports PHPCR persistence only. It deletes the currently selected + content once you confirmed deletion in the frontend. If the currently selected property is + a property of the page the whole page is deleted. + +In a more complex setup you need to create your own workflow instance, register it with CreatePHP +and implement your logic in the workflows run method. + +Currently the bundle only supports delete workflows but that will change in the future. + Read On ------- @@ -520,7 +591,6 @@ Read On * :doc:`other-editors` * :doc:`configuration` - .. _`create.js`: http://createjs.org .. _`hallo.js`: http://hallojs.org .. _`CKEditor`: http://ckeditor.com/ diff --git a/bundles/create/other-editors.rst b/bundles/create/other-editors.rst index f50d1b60..72dbc65e 100644 --- a/bundles/create/other-editors.rst +++ b/bundles/create/other-editors.rst @@ -34,7 +34,7 @@ Then re-run composer: .. code-block:: bash - $ php composer.phar run-scripts + $ composer run-scripts In your template, load the JavaScript files using: diff --git a/bundles/media/introduction.rst b/bundles/media/introduction.rst index 7c7f0774..a1ab419e 100644 --- a/bundles/media/introduction.rst +++ b/bundles/media/introduction.rst @@ -59,6 +59,9 @@ Installation cmf_media_image: resource: "@CmfMediaBundle/Resources/config/routing/image.xml" + _liip_imagine: + resource: "@LiipImagineBundle/Resources/config/routing.xml" + .. code-block:: xml diff --git a/bundles/menu/configuration.rst b/bundles/menu/configuration.rst index 74649283..9c9c5fd4 100644 --- a/bundles/menu/configuration.rst +++ b/bundles/menu/configuration.rst @@ -180,6 +180,68 @@ admin_recursive_breadcrumbs When editing a node, this setting will cause the Sonata admin breadcrumb to include ancestors of the node being edited. +Admin Extensions +---------------- + +The ``admin_extensions`` section contains the configurations of the admin extensions that comes with the menu bundle. + +menu_options +~~~~~~~~~~~~ + +You can configure the menu options extension in this sections. + +.. configuration-block:: + + .. code-block:: yaml + + cmf_menu: + # ... + cmf_menu: + admin_extensions: + menu_options: + enabled: auto + advanced: false + + .. code-block:: xml + + + + + + + + + + + .. code-block:: php + + $container->loadFromExtension('cmf_menu', array( + 'admin_extensions' => array( + 'menu_options' => array( + 'enabled' => 'auto', + 'advanced' => false, + ), + ), + ), + )); + +enabled +""""""" +**type**: ``enum`` **valid values**: ``true|false|auto`` **default**: ``auto`` + +If ``true``, the admin extension is activated. If set to ``auto``, it will be +activated only if the SonataAdminBundle is present. + +advanced +"""""""" +**type**: ``boolean`` **default**: ``false`` + +if set to ``true`` it will expose the advanced options in the admin. +To enable this options you need ``BurgovKeyValueFormBundle`` + Voter ----- diff --git a/bundles/menu/introduction.rst b/bundles/menu/introduction.rst index 65507eb0..c786ac32 100644 --- a/bundles/menu/introduction.rst +++ b/bundles/menu/introduction.rst @@ -11,8 +11,7 @@ features: * Render menus stored in the persistence layer; * Generate menu node URLs from linked Content or Route. -Note that only the Doctrine PHPCR-ODM persistence layer is supported in the -1.0 release. +Note that only the Doctrine PHPCR-ODM persistence layer is currently supported. .. caution:: diff --git a/bundles/menu/sonata_admin.rst b/bundles/menu/sonata_admin.rst index 970e4124..75f1ac73 100644 --- a/bundles/menu/sonata_admin.rst +++ b/bundles/menu/sonata_admin.rst @@ -121,6 +121,114 @@ configuration in the ``sonata_admin`` section of your project configuration: See the `Sonata Admin extension documentation`_ for more information. +MenuOptionInterface Sonata Admin Extension +------------------------------------------ + +This bundle provides an extension that allows user to edit different menu +options using the Sonata admin interface. + +To enable the extensions in your admin classes, simply define the extension +configuration in the ``sonata_admin`` section of your project configuration: + +.. configuration-block:: + + .. code-block:: yaml + + # app/config/config.yml + sonata_admin: + # ... + extensions: + cmf_menu.admin_extension.menu_options: + implements: + - Symfony\Cmf\Bundle\MenuBundle\Model\MenuOptionsInterface + + .. code-block:: xml + + + + + + + + + Symfony\Cmf\Bundle\MenuBundle\Model\MenuOptionsInterface + + + + + .. code-block:: php + + // app/config/config.php + $container->loadFromExtension('sonata_admin', array( + 'extensions' => array( + 'cmf_menu.admin_extension.menu_options' => array( + 'implements' => array( + 'Symfony\Cmf\Bundle\MenuBundle\Model\MenuOptionsInterface', + ), + ), + ), + )); + +See the `Sonata Admin extension documentation`_ for more information. + +These are the list of available options: + + * Display; + * Display children; + * Menu attributes (advanced); + * Label attributes (advanced); + * Children attributes (advanced); + * Link attributes (advanced). + +See the `KnpMenuBundle documentation`_ for more information about these +attributes. + +By default the only available options are **Display** and **Display Children**. +To enable the advaned options you need to add ``burgov/key-value-form-bundle`` +requirement in your ``composer.json`` and enable the advanced options in +your config file: + +.. configuration-block:: + + .. code-block:: yaml + + # app/config/config.yml + cmf_menu: + admin_extensions: + menu_options: + advanced: true + + + .. code-block:: xml + + + + + + + + + + + + + + .. code-block:: php + + // app/config/config.php + $container->loadFromExtension('cmf_menu', array( + 'admin_extensions' => array( + 'menu_options' => array( + 'advanced' => true, + ), + ), + )); + .. _`Sonata Admin extension documentation`: http://sonata-project.org/bundles/admin/master/doc/reference/extensions.html .. _SonataDoctrinePHPCRAdminBundle: http://sonata-project.org/bundles/doctrine-phpcr-admin/master/doc/index.html .. _`configuring sonata admin`: http://sonata-project.org/bundles/doctrine-phpcr-admin/master/doc/reference/configuration.html +.. _`KnpMenuBundle documentation`: http://github.com/KnpLabs/KnpMenu/blob/master/doc/01-Basic-Menus.markdown#menu-attributes diff --git a/bundles/phpcr_odm/configuration.rst b/bundles/phpcr_odm/configuration.rst index 205ccd58..ce981ada 100644 --- a/bundles/phpcr_odm/configuration.rst +++ b/bundles/phpcr_odm/configuration.rst @@ -459,6 +459,7 @@ not configure anything here, the ODM services will not be loaded. instance_class: ~ class: ~ id: ~ + namespace: ~ .. code-block:: xml @@ -494,6 +495,7 @@ not configure anything here, the ODM services will not be loaded. instance-class="null" class="null" id="null" + namespace="null" /> @@ -526,6 +528,7 @@ not configure anything here, the ODM services will not be loaded. 'instance_class' => null, 'class' => null, 'id' => null, + 'namespace' => null, ), ), )); @@ -582,6 +585,14 @@ metadata_cache_driver Configure a cache driver for the Doctrine metadata. This is the same as for `Doctrine ORM`_. +The ``namespace`` value is useful if you are using one primary caching server +for multiple sites that have similar code in their respective ``vendor/`` +directories. By default, Symfony will try to generate a unique namespace +value for each application but if code is very similar between two +applications, it is very easy to have two applications share the same +namespace. This option also prevents Symfony from needing to re-build +applicationcache on each Composer update on a newly generated namespace. + General Settings ~~~~~~~~~~~~~~~~ diff --git a/bundles/phpcr_odm/fixtures_initializers.rst b/bundles/phpcr_odm/fixtures_initializers.rst index 8a10d3b2..ec56402c 100644 --- a/bundles/phpcr_odm/fixtures_initializers.rst +++ b/bundles/phpcr_odm/fixtures_initializers.rst @@ -298,6 +298,11 @@ A simple example fixture class looks like this:: { public function load(ObjectManager $manager) { + if (!$manager instanceof DocumentManager) { + $class = get_class($manager); + throw new \RuntimeException("Fixture requires a PHPCR ODM DocumentManager instance, instance of '$class' given."); + } + // ... create and persist your data here } } diff --git a/bundles/phpcr_odm/introduction.rst b/bundles/phpcr_odm/introduction.rst index ba2c2f9d..fbbc3b5e 100644 --- a/bundles/phpcr_odm/introduction.rst +++ b/bundles/phpcr_odm/introduction.rst @@ -46,9 +46,9 @@ If you want to use PHPCR-ODM, you additionally need to require require: { ... - "jackalope/jackalope-doctrine-dbal": "1.1.*", - "doctrine/phpcr-odm": "1.1.*", - "doctrine/phpcr-bundle": "1.1.*", + "jackalope/jackalope-doctrine-dbal": "1.2.*", + "doctrine/phpcr-odm": "1.2.*", + "doctrine/phpcr-bundle": "1.2.*", ... } diff --git a/bundles/routing/configuration.rst b/bundles/routing/configuration.rst index 83889e80..18f4beb2 100644 --- a/bundles/routing/configuration.rst +++ b/bundles/routing/configuration.rst @@ -321,6 +321,7 @@ phpcr content_basepath: /cms/content admin_basepath: /cms/routes use_sonata_admin: auto + enable_initializer: true .. code-block:: xml @@ -336,6 +337,7 @@ phpcr content-basepath="/cms/content" admin-basepath="/cms/routes" use-sonata-admin="auto" + enable_initializer="true" > /cms/routes /cms/simple @@ -351,15 +353,16 @@ phpcr 'dynamic' => array( 'persistence' => array( 'phpcr' => array( - 'enabled' => false, - 'manager_name' => null, - 'route_basepaths' => array( + 'enabled' => false, + 'manager_name' => null, + 'route_basepaths' => array( '/cms/routes', '/cms/simple', ) - 'content_basepath' => '/cms/content', - 'admin_basepath' => '/cms/routes', - 'use_sonata_admin' => 'auto', + 'content_basepath' => '/cms/content', + 'admin_basepath' => '/cms/routes', + 'use_sonata_admin' => 'auto', + 'enable_initializer' => true, ), ), ), @@ -424,6 +427,27 @@ SonataPhpcrAdminBundle is present. If the :doc:`CoreBundle <../core/introduction>` is registered, this will default to the value of ``cmf_core.persistence.phpcr.use_sonata_admin``. +enable_initializer +****************** + +**type**: ``boolean`` **default**: ``true`` + +.. versionadded:: 1.3 + This configuration option was introduced in RoutingBundle 1.3. + +The bundle comes with an initializer that creates the nodes for the ``admin_basepath`` +automatically when initializing the repository or loading fixtures. Sometimes this +is not what you want, as the created node is of type 'Generic' and sometimes this +already needs to be a route (for the homepage). Set this to false to disable the +initializer when you create your nodes your self (e.g. using Alice_). + +.. caution:: + + Initializers are forced to be disabled when Sonata Admin is not enabled. + In such cases, you might have multiple route basepaths which are created + by other sources. If the route basepath isn't created by another source, + you have to configure an :ref:`initializer `. + orm """ @@ -575,3 +599,5 @@ no locale in their static pattern get the ``auto_locale_pattern`` option set. This is ignored if there are no ``locales`` configured. It makes no sense to enable this option when ``match_implicit_locale`` is disabled. + +.. _Alice: https://github.com/nelmio/alice diff --git a/bundles/seo/seo_aware.rst b/bundles/seo/seo_aware.rst index 78cb5f9b..bbfa9eab 100644 --- a/bundles/seo/seo_aware.rst +++ b/bundles/seo/seo_aware.rst @@ -156,6 +156,11 @@ And after that, you can use the { public function load(ObjectManager $manager) { + if (!$dm instanceof DocumentManager) { + $class = get_class($dm); + throw new \RuntimeException("Fixture requires a PHPCR ODM DocumentManager instance, instance of '$class' given."); + } + $page = new Page(); // ... set some page properties diff --git a/bundles/simple_cms/menus.rst b/bundles/simple_cms/menus.rst index db3ce57b..ecd2adcb 100644 --- a/bundles/simple_cms/menus.rst +++ b/bundles/simple_cms/menus.rst @@ -4,7 +4,7 @@ Menus ----- -You can use `Knp Menu Bundle`_ to render a menu of your SimpleCms pages. The default Page document +You can use `Knp Menu Bundle`_ to render a menu of your SimpleCms pages. The default Page document (``Symfony\Cmf\Bundle\SimpleCmsBundle\Doctrine\Phpcr\Page``) implements the ``Knp\Menu\NodeInterface`` which allows for rendering them as a menu. @@ -41,4 +41,10 @@ setDisplay($display) setDisplayChildren($displayChildren) Boolean which determines whether children should be added to the menu +.. tip:: + + If you use Sonata Admin in your project you can edit the menu options + using the MenuOptionsExtension that comes with the menu bundle. For more + information on how to use it take a look at the :doc:`menu bundle documentation <../menu/sonata_admin>` + .. _`Knp Menu Bundle`: https://github.com/KnpLabs/KnpMenuBundle diff --git a/components/testing.rst b/components/testing.rst index 1723e8bb..b8a11884 100644 --- a/components/testing.rst +++ b/components/testing.rst @@ -19,7 +19,7 @@ Add the following dependency to the ``require-dev`` section of ``composer.json`` .. code-block:: javascript "require-dev": { - "symfony-cmf/testing": "1.1.*" + "symfony-cmf/testing": "1.2.*" }, .. note:: diff --git a/conf.py b/conf.py index a0cec41e..3dbe7d44 100644 --- a/conf.py +++ b/conf.py @@ -55,9 +55,9 @@ # built documents. # # The short X.Y version. -version = '1.1.0' +version = '1.2.0' # The full version, including alpha/beta/rc tags. -release = '1.1.0' +release = '1.2.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/cookbook/database/create_new_project_phpcr_odm.rst b/cookbook/database/create_new_project_phpcr_odm.rst index 81fa903b..0e01909a 100644 --- a/cookbook/database/create_new_project_phpcr_odm.rst +++ b/cookbook/database/create_new_project_phpcr_odm.rst @@ -26,7 +26,7 @@ content repository. .. code-block:: bash - $ php composer.phar create-project symfony/framework-standard-edition / --no-install + $ composer create-project symfony/framework-standard-edition / --no-install **Step 2**: Add the required packages to ``composer.json``: @@ -36,9 +36,9 @@ content repository. ... "require": { ... - "doctrine/phpcr-bundle": "1.1.*", - "doctrine/phpcr-odm": "1.0.*", - "jackalope/jackalope-doctrine-dbal": "1.0.0" + "doctrine/phpcr-bundle": "1.2.*", + "doctrine/phpcr-odm": "1.2.*", + "jackalope/jackalope-doctrine-dbal": "1.2.*" } } diff --git a/cookbook/database/doctrine_cache.rst b/cookbook/database/doctrine_cache.rst index 4ed66160..ec33ceff 100644 --- a/cookbook/database/doctrine_cache.rst +++ b/cookbook/database/doctrine_cache.rst @@ -6,7 +6,7 @@ Jackalope Doctrine DBAL gets better performance when running it with the .. code-block:: bash - $ php composer.phar require doctrine/doctrine-cache-bundle:1.0.* + $ composer require doctrine/doctrine-cache-bundle:1.0.* And adding the following entry to your ``app/AppKernel.php``:: diff --git a/cookbook/editions/cmf_core.rst b/cookbook/editions/cmf_core.rst index 8680caf0..c43e9f29 100644 --- a/cookbook/editions/cmf_core.rst +++ b/cookbook/editions/cmf_core.rst @@ -37,14 +37,14 @@ Add the following to your ``composer.json`` file: "require": { ... - "symfony-cmf/symfony-cmf": "1.1.*" + "symfony-cmf/symfony-cmf": "1.2.*" } And then run: .. code-block:: bash - $ php composer.phar update + $ composer update Initialize bundles ~~~~~~~~~~~~~~~~~~ diff --git a/cookbook/editions/cmf_sandbox.rst b/cookbook/editions/cmf_sandbox.rst index 80b5e5f3..dac834e8 100644 --- a/cookbook/editions/cmf_sandbox.rst +++ b/cookbook/editions/cmf_sandbox.rst @@ -48,9 +48,8 @@ and then get the Symfony CMF code with it (this may take a while): .. code-block:: bash - $ php composer.phar create-project --no-install symfony-cmf/sandbox ~1.1 + $ composer create-project --no-install symfony-cmf/sandbox ~1.2 $ cd - $ mv ../composer.phar . Getting the Sandbox Code: GIT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -88,7 +87,7 @@ Next, use composer to install the necessary bundles (this may take a while): .. code-block:: bash - $ php composer.phar install + $ composer install .. note:: diff --git a/quick_tour/the_big_picture.rst b/quick_tour/the_big_picture.rst index ee77e4f3..58da1e57 100644 --- a/quick_tour/the_big_picture.rst +++ b/quick_tour/the_big_picture.rst @@ -45,7 +45,7 @@ The best way to download the Symfony CMF Standard Edition is using Composer_: .. code-block:: bash - $ php composer.phar create-project symfony-cmf/standard-edition cmf ~1.1 + $ composer create-project symfony-cmf/standard-edition cmf ~1.2 Setting up the Database ~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/quick_tour/the_model.rst b/quick_tour/the_model.rst index 4a8fa82c..cacf6c81 100644 --- a/quick_tour/the_model.rst +++ b/quick_tour/the_model.rst @@ -116,6 +116,11 @@ PHPCR. But first, you have to create a new Page document:: // ... public function load(ObjectManager $documentManager) { + if (!$documentManager instanceof DocumentManager) { + $class = get_class($documentManager); + throw new \RuntimeException("Fixture requires a PHPCR ODM DocumentManager instance, instance of '$class' given."); + } + $page = new Page(); // create a new Page object (document) $page->setName('new_page'); // the name of the node $page->setLabel('Another new Page'); @@ -130,6 +135,11 @@ it as its parent:: // ... public function load(ObjectManager $documentManager) { + if (!$documentManager instanceof DocumentManager) { + $class = get_class($documentManager); + throw new \RuntimeException("Fixture requires a PHPCR ODM DocumentManager instance, instance of '$class' given."); + } + // ... // get root document (/cms/simple) @@ -144,6 +154,11 @@ document using the Doctrine API:: // ... public function load(ObjectManager $documentManager) { + if (!$documentManager instanceof DocumentManager) { + $class = get_class($documentManager); + throw new \RuntimeException("Fixture requires a PHPCR ODM DocumentManager instance, instance of '$class' given."); + } + // ... $documentManager->persist($page); // add the Page in the queue $documentManager->flush(); // add the Page to PHPCR diff --git a/quick_tour/the_router.rst b/quick_tour/the_router.rst index 6e7a2402..1592a9a8 100644 --- a/quick_tour/the_router.rst +++ b/quick_tour/the_router.rst @@ -158,6 +158,11 @@ Now you can add a new ``Route`` to the tree using Doctrine:: { public function load(ObjectManager $documentManager) { + if (!$documentManager instanceof DocumentManager) { + $class = get_class($documentManager); + throw new \RuntimeException("Fixture requires a PHPCR ODM DocumentManager instance, instance of '$class' given."); + } + $routesRoot = $documentManager->find(null, '/cms/routes'); $route = new Route(); diff --git a/tutorial/auto-routing.rst b/tutorial/auto-routing.rst index 61ce7203..7ef168d7 100644 --- a/tutorial/auto-routing.rst +++ b/tutorial/auto-routing.rst @@ -190,7 +190,7 @@ You can now proceed to mapping your documents, create the following in your diff --git a/tutorial/getting-started.rst b/tutorial/getting-started.rst index 8d2c5645..3ce53670 100644 --- a/tutorial/getting-started.rst +++ b/tutorial/getting-started.rst @@ -372,6 +372,11 @@ Create a page for your CMS:: { public function load(ObjectManager $dm) { + if (!$dm instanceof DocumentManager) { + $class = get_class($dm); + throw new \RuntimeException("Fixture requires a PHPCR ODM DocumentManager instance, instance of '$class' given."); + } + $parent = $dm->find(null, '/cms/pages'); $page = new Page(); diff --git a/tutorial/the-frontend.rst b/tutorial/the-frontend.rst index 377fd720..ca352ba2 100644 --- a/tutorial/the-frontend.rst +++ b/tutorial/the-frontend.rst @@ -119,6 +119,11 @@ to which you will add the existing ``Home`` page and an additional ``About`` pag { public function load(ObjectManager $dm) { + if (!$dm instanceof DocumentManager) { + $class = get_class($dm); + throw new \RuntimeException("Fixture requires a PHPCR ODM DocumentManager instance, instance of '$class' given."); + } + $parent = $dm->find(null, '/cms/pages'); $rootPage = new Page();