Configuration Reference
Configuration Reference¶
Note
To focus our efforts onto a manageable number of packages, this package is currently not maintained. Security fixes and submitted bug fixes will still be released, but no new features should be expected. This bundle might have outdated documentation, there is no support from the CMF team and you should not expect bugs to be fixed.
If you want to help co-maintaining this package, tell us in a GitHub issue or in #symfony_cmf of the Symfony devs slack.
The SearchBundle can be configured under the cmf_search
key in your
application configuration. When using XML, you can use the
http://cmf.symfony.com/schema/dic/search
namespace.
Configuration¶
persistence
¶
phpcr
¶
This defines the persistence driver. The default configuration of persistence is the following configuration:
- YAML
1 2 3 4 5 6 7 8 9 10 11
cmf_search: show_paging: false persistence: phpcr: enabled: false search_basepath: /cms/content manager_registry: doctrine_phpcr manager_name: ~ translation_strategy: ~ search_fields: [] max_results: ~
- XML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
<?xml version="1.0" charset="UTF-8" ?> <container xmlns="http://symfony.com/schema/dic/services"> <config xmlns="http://cmf.symfony.com/schema/dic/core"> <persistence> <phpcr enabled="false" search-basepath="/cms/content" manager-registery="doctrine_phpcr" manager-name="null" translation-strategy="null" > <search-field> <title>title</title> <summary>body</summary> </search-field> max-results="null" </phpcr> </persistence> </config> </container>
- PHP
1 2 3 4 5 6 7 8 9 10 11 12
$container->loadFromExtension('cmf_search', array( 'enabled' => false, 'search_basepath' => '/cms/content', 'manager_registry' => 'doctrine_phpcr', 'manager_name' => null, 'translation_strategy' => null 'search_fields' => array( 'title' => 'title', 'summary' => 'body', ), 'max_results' => null ));
enabled
¶
type: boolean
default: false
If true
, PHPCR is enabled in the service container.
If the CoreBundle is registered, this will default to
the value of cmf_core.persistence.phpcr.enabled
.
PHPCR can be enabled by multiple ways such as:
- YAML
1 2 3 4 5 6
phpcr: ~ # use default configuration # or phpcr: true # straight way # or phpcr: manager: ... # or any other option under 'phpcr'
- XML
1 2 3 4 5 6 7 8 9 10
<persistence> <!-- use default configuration --> <phpcr /> <!-- or setting it the straight way --> <phpcr>true</phpcr> <!-- or setting an option under 'phpcr' --> <phpcr manager="..." /> </persistence>
- PHP
1 2 3 4 5 6 7 8 9 10 11 12
$container->loadFromExtension(..., array( // bundle configuration key, e.g. cmf_menu // ... 'persistence' => array( 'phpcr' => null, // use default configuration // or 'phpcr' => true, // straight way // or 'phpcr' => array( 'manager' => '...', // or any other option under 'phpcr' ), ), ));
search_basepath
¶
type: string
default: /cms/content
The basepath for CMS documents in the PHPCR tree.
If the CoreBundle is registered, this will default to
the value of %cmf_core.persistence.phpcr.basepath%/content
.
manager_registry
¶
type: string
default: doctrine_phpcr
If the CoreBundle is registered, this will default to
the value of cmf_core.persistence.phpcr.manager_registry
.
manager_name
¶
type: string
default: null
The name of the Doctrine Manager to use. null
tells the manager registry to
retrieve the default manager.
If the CoreBundle is registered, this will default to
the value of cmf_core.persistence.phpcr.manager_name
.
translation_strategy
¶
type: string
default: null
The translation strategy used in the documents that are searched. Can either be null
,
child
or attribute
.
search_fields
¶
type: array
default: array()
The PHPCR node properties that should be read and passed to the template. The key is the name of the PHPCR node property, the value is the variable name used to pass the data to the template.
- YAML
1 2 3
search_fields: title: title summary: body
- XML
1 2 3 4
<search-field> <title>title</title> <summary>body</summary> </search-field>
- PHP
1 2 3 4 5 6
$container->loadFromExtension('cmf_search', array( 'search_fields' => array( 'title' => 'title', 'summary' => 'body', ), ));
This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.