Download the PHP package gdbots/ncr-bundle without Composer
On this page you can find all versions of the php package gdbots/ncr-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gdbots/ncr-bundle
More information about gdbots/ncr-bundle
Files in gdbots/ncr-bundle
Package ncr-bundle
Short Description Symfony bundle that integrates gdbots/ncr library.
License Apache-2.0
Homepage https://github.com/gdbots/ncr-bundle-php
Informations about the package ncr-bundle
ncr-bundle-php
Symfony bundle that integrates gdbots/ncr library.
Configuration
Follow the standard bundle install using gdbots/ncr-bundle as the composer package name.
The examples below assume you're running the DynamoDb Ncr and Elastica NcrSearch.
config/packages/ncr.yml:
Controllers
It is recommended to have data retrieval be the responsibility of Pbjx requests, however, that strategy doesn't work for all uses cases. Use Symfony autowiring and typehint the interface in your constructor or setter methods to get key Ncr services.
Autowiring supported for these interfaces:
Gdbots\Ncr\Ncr
Gdbots\Ncr\NcrCache
Gdbots\Ncr\NcrLazyLoader
Gdbots\Ncr\NcrSearch
Twig Extension
The NcrExtension
provides a function called ncr_get_node
. It is important to note that this does NOT make a query to get a node, instead it pulls from NcrCache
.
This might change in the future, but this strategy eliminates horribly performing twig templates that make Ncr queries.
The function will accept a MessageRef
, NodeRef
or a string version of a NodeRef.
Example use of ncr_get_node:
Other twig functions (documentation wip):
- ncr_deref_nodes
- ncr_get_preloaded_nodes
- ncr_get_preloaded_published_nodes
- ncr_is_node_published
- ncr_preload_node
- ncr_preload_nodes
- ncr_preload_embedded_nodes
- ncr_to_node_ref
Console Commands
This library provides the basics for creating and extracting data from the Ncr services. Run the Symfony console and look for ncr commands.
Review the --help
on the ncr commands for more details.