Skip to content

Commit 8f18d6b

Browse files
committed
replace StaticContent by DemoSeoContent
1 parent 8b1db90 commit 8f18d6b

File tree

5 files changed

+45
-34
lines changed

5 files changed

+45
-34
lines changed

app/config/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ cmf_core:
9595
phpcr:
9696
enabled: true
9797

98+
cmf_content:
99+
persistence:
100+
phpcr:
101+
document_class: Sandbox\MainBundle\Document\DemoSeoContent
102+
98103
cmf_routing:
99104
chain:
100105
routers_by_id:

composer.lock

Lines changed: 24 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Sandbox/MainBundle/DataFixtures/PHPCR/LoadStaticPageData.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@
88

99
use PHPCR\Util\NodeHelper;
1010

11-
use Sandbox\MainBundle\Document\DemoSeoMetadata;
11+
use Sandbox\MainBundle\Document\DemoSeoContent;
1212
use Symfony\Cmf\Bundle\SeoBundle\Model\SeoMetadata;
1313
use Symfony\Component\DependencyInjection\ContainerAware;
1414
use Symfony\Component\Yaml\Parser;
1515

16-
use Symfony\Cmf\Bundle\ContentBundle\Doctrine\Phpcr\StaticContent;
17-
1816
class LoadStaticPageData extends ContainerAware implements FixtureInterface, OrderedFixtureInterface
1917
{
2018
public function getOrder()
@@ -40,8 +38,8 @@ public function load(ObjectManager $manager)
4038
$path = $basepath . '/' . $overview['name'];
4139
$page = $manager->find(null, $path);
4240
if (!$page) {
43-
$class = isset($overview['class']) ? $overview['class'] : 'Symfony\\Cmf\\Bundle\\ContentBundle\\Doctrine\\Phpcr\\StaticContent';
44-
/** @var $page StaticContent */
41+
$class = isset($overview['class']) ? $overview['class'] : 'Sandbox\\MainBundle\\Document\\DemoSeoContent';
42+
/** @var $page DemoSeoContent */
4543
$page = new $class();
4644
$page->setName($overview['name']);
4745
$page->setParentDocument($parent);
@@ -75,7 +73,7 @@ public function load(ObjectManager $manager)
7573
}
7674

7775
//add a loading for a simple seo aware page
78-
$seoDemo = new DemoSeoMetadata();
76+
$seoDemo = new DemoSeoContent();
7977
$seoDemo->setName('simple-seo-example');
8078
$seoDemo->setTitle('Simple seo example');
8179
$seoDemo->setBody(

src/Sandbox/MainBundle/Document/DemoSeoMetadata.php renamed to src/Sandbox/MainBundle/Document/DemoSeoContent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @author Maximilian Berghoff <Maximilian.Berghoff@gmx.de>
1818
*/
19-
class DemoSeoMetadata extends StaticContent implements SeoAwareInterface
19+
class DemoSeoContent extends StaticContent implements SeoAwareInterface
2020
{
2121
/**
2222
* @var SeoMetadata

src/Sandbox/MainBundle/Document/DemoSeoExtractor.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Sandbox\MainBundle\Document;
44

55
use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCRODM;
6-
use Symfony\Cmf\Bundle\ContentBundle\Doctrine\Phpcr\StaticContent;
76
use Symfony\Cmf\Bundle\SeoBundle\Extractor\SeoDescriptionReadInterface;
87
use Symfony\Cmf\Bundle\SeoBundle\Extractor\SeoOriginalUrlReadInterface;
98
use Symfony\Cmf\Bundle\SeoBundle\Extractor\SeoTitleReadInterface;
@@ -16,9 +15,10 @@
1615
*
1716
* @author Maximilian Berghoff <Maximilian.Berghoff@gmx.de>
1817
*/
19-
class DemoSeoExtractor extends StaticContent implements
18+
class DemoSeoExtractor extends DemoSeoContent implements
2019
SeoTitleReadInterface,
21-
SeoDescriptionReadInterface
20+
SeoDescriptionReadInterface,
21+
SeoOriginalUrlReadInterface
2222
{
2323
/**
2424
* {@inheritDoc}
@@ -35,4 +35,12 @@ public function getSeoDescription()
3535
{
3636
return substr($this->getBody(), 0, 200).' ...';
3737
}
38+
39+
/**
40+
* {@inheritDoc}
41+
*/
42+
public function getSeoOriginalUrl()
43+
{
44+
return "/home";
45+
}
3846
}

0 commit comments

Comments
 (0)