2017 © Pedro Peláez
 

symfony-bundle utils-bundle

All kinds of goodies for the BlastCoreBundle

image

blast-project/utils-bundle

All kinds of goodies for the BlastCoreBundle

  • Friday, March 16, 2018
  • by beta
  • Repository
  • 3 Watchers
  • 1 Stars
  • 5,359 Installations
  • PHP
  • 8 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 15 Versions
  • 0 % Grown

The README.md

Blast UtilsBundle

Build Status Coverage Status License, (*1)

Latest Stable Version Latest Unstable Version Total Downloads, (*2)

Features

Blast Choices

Documentation to be writen, (*3)

Blast Hooks

This bundle introduce a hook feature that is really basic hook management., (*4)

You can define in your views any hook you want., (*5)

Declare the hook target location in a view

{# myTemplate.html.twig #}



Here my custom hook

{{ blast_hook('my.custom.hook', {'someParameters': myVar}) }}

A hook can be declared without using any parameters. If so, the « hook block » won't have any parameters defined in handleParameters's method parameter (var $hookParameters will be an empty array)., (*6)

Declare your Hook class

This class will manage rendering of the hook content by setting view parameters (act as a controller), (*7)

<?php

namespace MyBundle\Hook\MyCustomHook;

use Blast\UtilsBundle\Hook\AbstractHook;

class MyCustomHookExample extends AbstractHook
{
    protected $hookName = 'my.custom.hook';
    protected $template = 'MyBundle:Hook:my_custom_hook_example.html.twig';

    public function handleParameters($hookParameters)
    {
        $this->templateParameters = [
            'someViewParameter' => 'a value that will be passed to the twig view'
        ];
    }
}

Note: you can get the current hook name (configured in service definition) in attribute AbstractHook::hookName ans the configured template in AbstractHook::template, (*8)

Register the hook class as service

    my_bundle.hook.my_custom_hook_example:
        class: MyBundle\Hook\MyCustomHook\MyCustomHookExample
        tags:
            - { name: blast.hook, hook: my.custom.hook, template: MyBundle:Hook:my_custom_hook_example.html.twig }

The hook configuration are sets in the service tag : - name: the service tag name (must be blast.hook) - hook: the target hook where the « block » will be rendered - template: the twig template of the « block », (*9)

Please don't forget the tag blast.hook in order to register your service as a hook, (*10)

Create your hook template

{# MyBundle:Hook:my_custom_hook_example.html.twig #}



Here's my first custom hook, with a view var : {{ someViewParameter }} ! , (*11)

And voila, you should have this rendered content :, (*12)

<div>
    <h1>Here my custom hook</h1>
    <p>
        Here's my first custom hook,  with a view var : a value that will be passed to the twig view !
    </p>
</div>

Blast Custom Filters

Enable the feature in config.yml, (*13)

# app/config/config.yml
blast_utils:
    features:
        customFilters:
            enabled: true

Optionnaly, you can define your own customFilter entity by setting it as below (don't forget to set the associated repository in order to override createNewCustomFilter method) :, (*14)

# app/config/config.yml
blast_utils:
    features:
        customFilters:
            enabled: true
            class: MyBundle\Entity\MyCustomFilter

You only have to set your User class entity in application config.yml (see https://symfony.com/doc/current/doctrine/resolve_target_entity.html for more informations), (*15)

# app/config/config.yml
doctrine:
    # ...
    orm:
        # ...
        resolve_target_entities:
            Blast\CoreBundle\Model\UserInterface: MyBundle\Entity\MyUser

If you're using Sylius, setting the doctrine.orm resolve_target_entities key will not work because Sylius is already using this system. You can declare your Interface / Entity replacement within SyliusResource configuration :, (*16)

# app/config/config.yml
sylius_resource:
    resources:
        blast.utils: # this is an arbitrary key
            classes:
                model: MyBundle\Entity\MyUser
                interface: Blast\CoreBundle\Model\UserInterface

Blast User Interface

In order to set User mapping with utils entity, the mapping with Interface is used., (*17)

There are 2 ways for configuring the real class that will replace the UserInterface :, (*18)

Using Sylius

declare, via resources, the class that will replace the model interface, (*19)

sylius_resource:
    resources:
        blast.utils:
            classes:
                model: MyBundle\Entity\MyRealUser
                interface: Blast\CoreBundle\Model\UserInterface

Using Syfony's Doctrine target entity resolver :

doctrine:
    # ...
    orm:
        #...
        resolve_target_entities:
            Blast\CoreBundle\Model\UserInterface: MyBundle\Entity\MyRealUser

The Versions

16/03 2018

dev-wip-platform

dev-wip-platform https://github.com/blast-project/UtilsBundle

All kinds of goodies for the BlastCoreBundle

  Sources   Download

LGPL-3.0 LGPL-3.0-only

The Requires

 

The Development Requires

by Baptiste SIMON
by Romain SANCHEZ
by Marcos Bezerra de Menezes

symfony sonata utils blast

15/11 2017

dev-wip-lisem

dev-wip-lisem https://github.com/blast-project/UtilsBundle

All kinds of goodies for the BlastCoreBundle

  Sources   Download

LGPL-3.0

The Requires

 

The Development Requires

by Baptiste SIMON
by Romain SANCHEZ
by Marcos Bezerra de Menezes

symfony sonata utils blast

03/11 2017

dev-master

9999999-dev https://github.com/blast-project/UtilsBundle

All kinds of goodies for the BlastCoreBundle

  Sources   Download

GPL-3.0 LGPL-3.0

The Requires

 

The Development Requires

by Baptiste SIMON
by Romain SANCHEZ
by Marcos Bezerra de Menezes

symfony sonata utils blast

03/11 2017

0.6.4

0.6.4.0 https://github.com/blast-project/UtilsBundle

All kinds of goodies for the BlastCoreBundle

  Sources   Download

LGPL-3.0

The Requires

 

The Development Requires

by Baptiste SIMON
by Romain SANCHEZ
by Marcos Bezerra de Menezes

symfony sonata utils blast

19/10 2017

0.5.2

0.5.2.0 https://github.com/blast-project/UtilsBundle

All kinds of goodies for the BlastCoreBundle

  Sources   Download

LGPL-3.0

The Requires

 

The Development Requires

by Baptiste SIMON
by Romain SANCHEZ
by Marcos Bezerra de Menezes

symfony sonata utils blast

26/09 2017

dev-wip-locale

dev-wip-locale https://github.com/blast-project/UtilsBundle

All kinds of goodies for the BlastCoreBundle

  Sources   Download

LGPL-3.0

The Requires

 

The Development Requires

by Baptiste SIMON
by Romain SANCHEZ
by Marcos Bezerra de Menezes

symfony sonata utils blast

15/09 2017

0.5.1

0.5.1.0 https://github.com/blast-project/UtilsBundle

All kinds of goodies for the BlastCoreBundle

  Sources   Download

LGPL-3.0

The Requires

 

The Development Requires

by Baptiste SIMON
by Romain SANCHEZ
by Marcos Bezerra de Menezes

symfony sonata utils blast

15/09 2017

dev-wip-test

dev-wip-test https://github.com/blast-project/UtilsBundle

All kinds of goodies for the BlastCoreBundle

  Sources   Download

LGPL-3.0

The Requires

 

The Development Requires

by Baptiste SIMON
by Romain SANCHEZ
by Marcos Bezerra de Menezes

symfony sonata utils blast

28/07 2017

0.4.5

0.4.5.0 https://github.com/blast-project/UtilsBundle

All kinds of goodies for the BlastCoreBundle

  Sources   Download

LGPL-3.0

The Requires

 

The Development Requires

by Baptiste SIMON
by Romain SANCHEZ
by Marcos Bezerra de Menezes

symfony sonata utils blast

27/06 2017

0.4.4

0.4.4.0 https://github.com/blast-project/UtilsBundle

All kinds of goodies for the BlastCoreBundle

  Sources   Download

LGPL-3.0

The Requires

 

The Development Requires

by Baptiste SIMON
by Romain SANCHEZ
by Marcos Bezerra de Menezes

symfony sonata utils blast

13/06 2017

0.4.3

0.4.3.0 https://github.com/blast-project/UtilsBundle

All kinds of goodies for the BlastCoreBundle

  Sources   Download

LGPL-3.0

The Requires

 

The Development Requires

by Baptiste SIMON
by Romain SANCHEZ
by Marcos Bezerra de Menezes

symfony sonata utils blast

04/05 2017

0.4.2

0.4.2.0 https://github.com/blast-project/UtilsBundle

All kinds of goodies for the BlastCoreBundle

  Sources   Download

LGPL-3.0

The Requires

 

The Development Requires

by Baptiste SIMON
by Romain SANCHEZ
by Marcos Bezerra de Menezes

symfony sonata utils blast

07/03 2017

dev-sf3.2

dev-sf3.2 https://github.com/blast-project/UtilsBundle

All kinds of goodies for the BlastCoreBundle

  Sources   Download

GPL-3.0

The Requires

 

by Baptiste SIMON
by Romain SANCHEZ
by Marcos Bezerra de Menezes

symfony sonata utils blast

07/03 2017

0.2

0.2.0.0 https://github.com/blast-project/UtilsBundle

All kinds of goodies for the BlastCoreBundle

  Sources   Download

GPL-3.0

The Requires

 

by Baptiste SIMON
by Romain SANCHEZ
by Marcos Bezerra de Menezes

symfony sonata utils blast

10/01 2017

0.1

0.1.0.0 https://github.com/blast-project/UtilsBundle

All kinds of goodies for the BlastCoreBundle

  Sources   Download

GPL-3.0

The Requires

 

by Baptiste SIMON
by Romain SANCHEZ
by Marcos Bezerra de Menezes

symfony sonata utils blast