A simple yet efficient publishing bundle.

0.2 2020-09-07 09:59 UTC

This package is auto-updated.

Last update: 2021-01-07 10:40:46 UTC


A simple yet efficient publishing bundle.


Register the bundle to your 'app/AppKernel.php'

    new Umanit\ContentPublicationBundle\UmanitContentPublicationBundle(),


Make your entity publishable

Implement the interface PublishableInterface and use the trait PublishableTrait.


namespace AppBundle\Entity\Content;

use Doctrine\ORM\Mapping as ORM;
use Umanit\ContentPublicationBundle\Doctrine\Model\PublishableInterface;
use Umanit\ContentPublicationBundle\Doctrine\Model\PublishableTrait;

 * @ORM\Table(name="news")
 * @ORM\Entity()
class News implements PublishableInterface
    use PublishableTrait;

This will add two fields to your entity, publishDate and unpublishDate. All your content will then be displayed only when the current datetime is between those fields.

(Optional) Disable the filter for a specific firewall

Usually you'll need to administrate your contents. For doing so, you can disable the filter by configuring the disabled_firewalls option.

# app/config/config.yml
    disabled_firewalls: ['admin']

To follow this example, you'll need to add the admin firewall to your `security.yml file. Check out the Symfony documentation for more details.