2017 © Pedro Peláez
 

library bootstrap-bundle

Bootstrap Common Bundle

image

vivait/bootstrap-bundle

Bootstrap Common Bundle

  • Thursday, December 22, 2016
  • by LewisW
  • Repository
  • 8 Watchers
  • 1 Stars
  • 7,144 Installations
  • HTML
  • 2 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 36 Versions
  • 9 % Grown

The README.md

BootstrapBundle

SensioLabsInsight Scrutinizer Code Quality Build Status, (*1)

A set of common templates and utilities to assist in rapid application development in Symfony., (*2)

Installation

Using composer

``` bash $ composer require vivait/bootstrap-bundle, (*3)


### Enabling bundle ``` php getMenu() ->getChild('main'); $members = $menu->addChild('Customers', array( 'dropdown' => true, 'caret' => true, )); $members->addChild('Dashboard', array( 'icon' => 'home', 'route' => 'myapp_customers_list' )); $members->addChild('Add new', array( 'icon' => 'plus', 'route' => 'myapp_customers_add' )); // ... etc. } } ?>

You'll then need to configure this event in your services.yml:, (*4)

myapp.mybundle.configure_menu_listener:
    class: MyApp\MyBundle\EventListener\ConfigureMenuListener
    tags:
     - { name: kernel.event_listener, event: vivait.bootstrap.menu_configure, priority: -2, method: onMenuConfigure }

Using the list hydrator

Bootstrap bundle includes a custom Doctrine hydrator, based on this blog post., (*5)

This hydrator is pretty straightforward, it examines the columns returned in each row of the resultset, if there are only two columns, the first is assumed to be the key field (which would normally be the objects ID) and the second is assumed to be the value field. If there are more than two columns per row then the returned array will be an ID indexed array with each row consisting of an array of the remaining column values., (*6)

To enable use of the hydrator, add the following to your config.yml:, (*7)

orm:
  hydrators:
    ListHydrator: \Vivait\BootstrapBundle\Hydrator\ListHydrator

For use with Doctrine ORM 2.5+, use \Vivait\BootstrapBundle\Hydrator\ListHydrator25, (*8)

and use when retrieving results from a query:, (*9)

$results = $this->getDoctrine()->getManager()->createQuery('{query}')->getResult('ListHydrator');

Using the user callable

At some point in your application, you may wish to inject the current user via the container. Bootstrap provides a helper class for this, based on this StackOverflow answer., (*10)

Simply inject vivait.bootstrap.user.callable, like in the following, (*11)

class: \My\Class
arguments: [@vivait.bootstrap.user.callable]

Then when you need to reference the current user in your class, just call userCallable::getCurrentUser, as follows:, (*12)

private $userCallable;

function __construct(UserCallable $userCallable) {
    $this->userCallable = $userCallable;
}

public function mailCurrentUser() {
    mail($userCallable->getCurrentUser()->getEmail(), 'Example', 'Please don\'t actually use this example method!');
}

The Versions

22/12 2016
12/12 2016

dev-fix/xss-vuln

dev-fix/xss-vuln

Bootstrap Common Bundle

  Sources   Download

MIT

The Requires

 

by Kiel Goodman

22/07 2016
21/07 2016

dev-feature/error-handling

dev-feature/error-handling

Bootstrap Common Bundle

  Sources   Download

proprietary

The Requires

 

by Kiel Goodman

02/10 2015
05/06 2014

1.1.1

1.1.1.0

Bootstrap Common Bundle

  Sources   Download

proprietary

The Requires

 

by Kiel Goodman