symfony-cmf/SeoBundle — pull request #122 by WouterJ (2014-04-06 21:08:00+00:00)
Title: Make extractors override metadata

This reverts #106

Imo (and in @ElectricMaxxx's opinion), the extractors should override the metadata. It's the task of the developer to determine what to do with the configured metadata by the admin. I've some examples to illustrate what I mean:

Assume a `BlogPost` document with tags. You want to use the tags for the keywords. However, the admin should also be able to add extra keywords. The current implementation doesn't let you do that, when defining what to do inside the extractor method, one can do:

````php
class BlogPost
{
public function getSeoKeywords()
{
$keywords = $this->seoMetadata->getMetaKeywords() ?: array();

return $keywords + $this->tags;
}
}
````

---

Assume a `Page` document with a title. By default, you want to use that title. However, if the admin decides to use another title, you want to use that instead. This is the current behaviour, after this PR one can do:

````php
class Page
{
public function getSeoTitle()
{
return $this->seoMetadata->getTitle() ?: $this->title;
}
}
````

Tl;dr: The developer should be able to define the behaviour himself, it should not be forced by the extractors.