sonata-project/SonataNewsBundle

Additional blocks

Closed this issue ยท 18 comments

Currently there are only two blocks: recent posts and recent comments.

I would add a few more:

  • Yearly archive
  • Monthly archive
  • Tags

nice idea, feel free to create a PR

PR per block or can go in one?

PR per Block ๐Ÿ‘

@OskarStark For the archive blocks, I would like to use DQL to correctly GROUP BY posts. YEAR and MONTH functions are removed from DQL as of 2.0. Doctrine allows to add user defined functions, but that's need to be configured in config.yml.

My questions are:

  1. Should I implement the YEAR and MONTH functions in NewsBundle or I can add https://github.com/beberlei/DoctrineExtensions as a dependency where these functions are already declared.
  2. Should I add the required configuration somehow or mention it in the docs (like the JsonType)

Hi @sagikazarmark

I'm ๐Ÿ‘ for 1.

@rande @soullivaneuh what do you think?

@OskarStark point 1 actually mentions two different ways. Both questions should be answered.

oh sorry ๐Ÿ˜„

i prefer the dependency

And what about the configuration?

same like JsonType IMO

OK, thanks

We are talking about blocks, not the feature. The block would list yearly/monthly archives where it is necessary to generate the list. Eg. 2014 five posts, 2015 ten posts, 2014 May one post, etc.

rande commented

Yes, I was more talking about the underlining code used by the controller, ie: how to retrieve the correct articles.

Well, the two things are different. In case of displaying posts there is only one argument (maybe two with the month).

When generating the block, there are no arguments, but there is a COUNT and a GROUP BY in the query.

For example: SELECT YEAR(p.publicationDateStart) AS year, MONTH(p.publicationDateStart) as month, COUNT(p.id) AS c FROM AppBundle\Entity\News\Post p GROUP BY year, month

So the code are totally different IMHO.

If your comment is related to the fact that the post displaying logic already exists: I know. That's why I mentioned only the blocks.

@OskarStark I know we agree in PR/block, but it would be easier if I could submit them in one PR. If I submit separate ones, there will be conflicts for example in documentation. Also, they are related, so I don't really see any reason why they couldn't be submitted in one PR.

Is that OK?

๐Ÿ‘

3 years and no activity, closing for now.

If any of the @sonata-project/contributors wants to contribute to this, feel free to reopen