4 * This file is part of the Symfony CMF package.
6 * (c) 2011-2015 Symfony CMF
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Cmf\Component\Routing;
15 * Interface used by the DynamicRouter to retrieve content by it's id when
16 * generating routes from content-id.
18 * This can be easily implemented using i.e. the Doctrine PHPCR-ODM
23 interface ContentRepositoryInterface
26 * Return a content object by it's id or null if there is none.
28 * If the returned content implements RouteReferrersReadInterface, it will
29 * be used to get the route from it to generate an URL.
31 * @param string $id id of the content object
33 * @return object A content that matches this id.
35 public function findById($id);
38 * Return the content identifier for the provided content object for
41 * @param object $content A content instance
43 * @return string|null $id id of the content object or null if unable to determine an id
45 public function getContentId($content);