symfony-cmf/CoreBundle — pull request #31 by dantleech (2013-04-20 10:02:02+00:00)
Title: [proposal] Adding ``isPublished`` method to PublishWorkflowInterface

Spoke to @lsmith on IRC, he said that having an explicit "is published" method had been discussed and rejected some time ago.

For me it is logical to have such a method, it would correspond to "draft|published" states of a blog post.

**Scenario 1** you are writing a new post that must be de-published at the end of April, so you set the end date accordingly (you don't write it down, you havn't got a pen). But you do not want the article to be published until it is finished.

Using the system proposed by the PublishWorkflowInterface you would set a start date in the future. But this is prone to error. You might accidentally set the start date to tomorrow and not realize it - resulting in an unfinished piece of work being published on the website. It would be better to explicitly state if the article is published or not.

**Senario 2**: You have an existing article which is now "live" - within its assigned publishing timeframe - but for reasons unspecified you must temporarily de-publish the article and revise it. Using the existing system you would set an EndDate in the past, but here we want to conserve the end date for when we republish the article.

----

We could "work around" the issues above in the implementation by not coupling the getStart and getEndDates to the database field, but this results in more logic in the application, and we lose two perfectly good accessor methods.

Also, what if the content doesn't care about start and end dates? Maybe we could have a base "PublishableInterface" which is extended by "PublishWorkflowInterface". That would save some lines of code.

Basically, if the user does what the interface proposes they will mixup "state" and "data".