-
Notifications
You must be signed in to change notification settings - Fork 27
Move publish workflow checker to provider decorator #221
Comments
Is there a chance for a little training in Naming of different Services and its purpose? You mentioned Voters, enhancers, Guesser and Providers in these two issues. Together with the decoration and a Guinness my head can't really follow you. |
Btw: it will be necessarry to cache that result like We do it for seo metadata after extraction. |
Voters Enhancers Guessers Providers Decoration class VoterProvider implements UrlInformationProviderInterface
{
private $provider;
private $voters;
public function __construct(UrlInformationProviderInterface $provider, array $voters = array())
{
$this->provider = $provider;
$this->voters = $voters;
}
public function getUrlInformations()
{
$urlInformations = $this->provider->getUrlInformations();
foreach ($urlInformations as $id => $urlInformation) {
foreach ($this->voters as $voter) {
if (false === $voter->accept($urlInformation)) {
unset($urlInformations[$id]);
break;
}
}
}
return $urlInformations;
}
} |
@wouterj that is awesome thanks. You should write a Book about that and Code Style. Just for a furrher ordering in my mind: |
Imagine we should provide a default List of enhancers and/or guessers as We do it for the seo metadata ectractors, which would you expect to be implemented? I just have the title -> label by getTitle() in my mind, this would be a guesser, right. But how would you expect one for changeFrequency or the other properties? Which one would you expect in general? Should We implement both? Enhancers and guessers? In in priotizised list? |
And should'nt we start to use named sitemaps in the tag definition of voters/enhancers/guessers? So We would be able to produce different sitemaps based on different voters? You would be able to create a separate xml sitemap for google and one in HTML for the Users. The last one can be separated into subsets by an ACL mechanism translated into the voters. (@wouterj mentioned it at the beginning) that would be ultra hot. |
Slowly i understand why @wouterj is calling it a bundle ... |
Was going to write that you can hook anything into the publish workflow. But then, decisions for the sitemap visibility are not the same as whether something is published or not. So i am +1 for having voters. not sure if we need a decorator or could just build it into the provider. performance wise its about the same, with the overhead of an extra class. |
And when we do that +1 on having the sitemap "name" somehow available to give the voters a context. hm, or go with the decorator and have one service per sitemap context. i guess the voters knowing about a context name is not very elegant. configuring the voters for a specific context sounds more generic. |
I guess another voter could be used to filter non-canonical urls for the same content - see also #218 i guess it depends what we generate - if we go over the /cms/content, there will be one url per document (in the requested language), but if we search /cms/routes, we would get all alternatives. |
btw, i wonder if we should call the data for UrlInformation |
We should have a VotingProvider which decorates a
UrlInformationProviderInterface
implementation. This is then used to vote if the UrlInformation is shown. The publish workflow checker would then be one voter.People might want to add more features, like ACL checks (as used by the kunstmaan guys Kunstmaan/KunstmaanBundlesCMS#46 ).
This also means the
UrlInformation
class should have a new property:$object
which contains the document/entity.The text was updated successfully, but these errors were encountered: