PHPackages                             vantt/drupal-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. vantt/drupal-bundle

ActiveSymfony-bundle[Framework](/categories/framework)

vantt/drupal-bundle
===================

Integrate Symfony4 with Drupal

1.0.0(10y ago)03MITPHPPHP &gt;=5.3.2

Since Jan 14Pushed 6y agoCompare

[ Source](https://github.com/vantt/EkinoDrupalBundle)[ Packagist](https://packagist.org/packages/vantt/drupal-bundle)[ Docs](https://github.com/ekino/EkinoDrupalBundle)[ RSS](/packages/vantt-drupal-bundle/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (4)Versions (5)Used By (0)

Bridge Bricks by 20steps inc. Symfony 4 to Drupal 7.x
=====================================================

[](#bridge-bricks-by-20steps-inc-symfony-4-to-drupal-7x)

- EkinoDrupalBundle was initially developed not for Symfony 4.
- This customized version is fixed for Symfony 4.4 and Symfony will handle Drupal session.
- The original version will let Drupal bootstrap first and then symfony. This version make Symfony first.
- Symfony will handle Drupal authentication
- We can use both Symfony Routing or Drupal menu for page handling.

---

The bundle deeply integrates Bricks by 20steps including Symfony 4 with Drupal7 and vice versa. This is done with small modification to Drupal core.

Install
-------

[](#install)

- Require this bundle.
- Enable bundle.
- Copy ToSymfony.patch to project root folder and apply it
- Copy files Resources/ekino\_drupal.yaml to config folder.
- Merge settings in Resources/security.yaml into the config/security.yaml
- Copy settings in Resources/ekino\_drupal\_routes.yaml into the end of config/routes.yaml
- Run MySQL Table Creation for sessions and rememberMe token.
- Tweak config/security.yaml for firewall control.

CREATE TABLE `sessions_sym` ( `sess_id` VARCHAR(128) NOT NULL PRIMARY KEY, `sess_data` BLOB NOT NULL, `sess_time` INTEGER UNSIGNED NOT NULL, `sess_lifetime` INTEGER UNSIGNED NOT NULL ) COLLATE utf8mb4\_bin, ENGINE = InnoDB;

CREATE TABLE `rememberme_token` ( `series` char(88) UNIQUE PRIMARY KEY NOT NULL, `value` char(88) NOT NULL, `lastUsed` datetime NOT NULL, `class` varchar(100) NOT NULL, `username` varchar(200) NOT NULL );

### Below is original Configuration from Ekino

[](#below-is-original-configuration-from-ekino)

Adapt the `etc/config/ekino_drupal.yaml` file to your needs:

```
parameters:
    session.flashbag.class:       Ekino\Bundle\DrupalBundle\Port\DrupalFlashBag
    session.attribute_bag.class:  Ekino\Bundle\DrupalBundle\Port\DrupalAttributeBag

framework:
    # ... configuration options
    session:
        # ... configuration options
        storage_id:     ekino.drupal.session.storage

ekino_drupal:
    root:          %kernel.root_dir%/../web
    logger:        ekino.drupal.logger.watchdog
    strategy_id:   ekino.drupal.delivery_strategy.symfony
    # attach a security token to the following provider keys
    provider_keys: [main, admin]

    # not required
    entity_repositories:
        # 3 equivalent examples of configuration:
        - { bundle: page }
        - { type: node, bundle: page }
        - { type: node, bundle: page, class: Ekino\Bundle\DrupalBundle\Entity\EntityRepository }
        # you can also define an entity repository:
        - { type: node, class: Application\Ekino\Bundle\DrupalBundle\Entity\Node\NodeRepository }

    # switch to true if you want to prefix the name of Symfony tables
    table_prefix:
        enabled: false
        prefix:  symfony__
        exclude: [users]

    # optional
    session:
        refresh_cookie_lifetime: true # default value: false

# declare 2 required mapping definition used by Drupal
doctrine:
    dbal:
        driver:   %database_driver%
        dbname:   %database_name%
        user:     %database_user%
        host:     %database_host%
        port:     %database_port%
        password: %database_password%
        charset:  UTF8

        mapping_types:
            longblob: object
            blob: object

        # Tips: this allows Doctrine to consider only tables starting with
        # "symfony__" during a migration generation.
        # Think to add Doctrine migrations table here or configure it in
        # the doctrine_migrations section (table_name)
        schema_filter: ~^(symfony__|migration_versions)~

```

The bundle comes with 3 delivery strategies:

- ekino.drupal.delivery\_strategy.background: Drupal never returns the response, Symfony does
- ekino.drupal.delivery\_strategy.drupal: Drupal always returns the response, even if the page is 404
- ekino.drupal.delivery\_strategy.symfony: Drupal returns the response only if the page is not 404

The (optional) section `entity_repositories` allows you to easy interact with Drupal 7.x API to retrieve contents and handle it from Symfony code. The configuration offers default values:

- default entity type is `node`
- default repository class is `Ekino\Bundle\DrupalBundle\Entity\EntityRepository`, feel free to configure yours

Update Queries
--------------

[](#update-queries)

```
UPDATE users SET `emailCanonical` = `mail`, `usernameCanonical` = `name`, `roles` = 'b:0;';
```

Usage
-----

[](#usage)

Symfony services can be used from within Drupal:

```
