libre-informatique/varieties-bundle

Plant taxonomy management : Family / Genus / Species / Subspecies / Variety

0.6.4 2017-11-03 15:10 UTC

This package is not auto-updated.

Last update: 2024-04-08 05:06:26 UTC


README

Build Status Coverage Status License

Latest Stable Version Latest Unstable Version Total Downloads

Installation

From a basic symfony project

composer require sonata-project/admin-bundle 3.x-dev
composer require sonata-project/doctrine-orm-admin-bundle 3.x-dev
composer require blast-project/core-bundle dev-master
composer require blast-project/outer-extension-bundle
composer require libre-informatique/sonata-sylius-user-bundle
composer require libre-informatique/varieties-bundle
composer require sonata-project/intl-bundle

Configuration

add variety.yml in app\config

app\config\config.yml

imports:
    - { resource: parameters.yml }
    - { resource: security.yml }
    - { resource: services.yml }
    - { resource: varieties.yml }
# Doctrine Configuration
doctrine:
    dbal:
        driver: pdo_pgsql
        host: '%database_host%'
        port: '%database_port%'
        dbname: '%database_name%'
        user: '%database_user%'
        password: '%database_password%'
        charset: UTF8
    orm:
        auto_generate_proxy_classes: '%kernel.debug%'
        naming_strategy: doctrine.orm.naming_strategy.underscore
        auto_mapping: true
        mappings:
            gedmo_loggable:
                type: annotation
                prefix: Gedmo\Loggable\Entity
                dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Loggable/Entity"
                alias: GedmoLoggable # (optional) it will default to the name set for the mappingmapping
                is_bundle: false

    # Sonata
sonata_block:
  default_contexts: [cms]
  blocks:

    # enable the SonataAdminBundle block
    sonata.admin.block.admin_list:
      contexts:   [admin]

blast_base_entities:
    orm:
        default:
            naming: true
            guidable: true
            timestampable: true
            addressable: true
            treeable: false
            nested_treeable: true
            nameable: true
            labelable: true
            emailable: true
            descriptible: true
            searchable: true
            loggable: true
            sortable: true
            normalize: true
            syliusGuidable: true

app\AppKernel.php

<?php

use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

public function registerBundles()
    {
        $bundles = [
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
            new Symfony\Bundle\SecurityBundle\SecurityBundle(),
            new Symfony\Bundle\TwigBundle\TwigBundle(),
            new Symfony\Bundle\MonologBundle\MonologBundle(),
            new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
            new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
            new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
            new AppBundle\AppBundle(),
            # Sonata
            new Sonata\CoreBundle\SonataCoreBundle(), 
            new Sonata\BlockBundle\SonataBlockBundle(), 
            new Knp\Bundle\MenuBundle\KnpMenuBundle(),
            new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
            new Sonata\AdminBundle\SonataAdminBundle(),
            new Sonata\IntlBundle\SonataIntlBundle(),
            # blast
            new Blast\CoreBundle\BlastCoreBundle(),
            new Blast\OuterExtensionBundle\BlastOuterExtensionBundle(),
            new Blast\BaseEntitiesBundle\BlastBaseEntitiesBundle(),
            new Blast\UtilsBundle\BlastUtilsBundle(),
            # bundle
            new Librinfo\VarietiesBundle\LibrinfoVarietiesBundle(),
            new Librinfo\MediaBundle\LibrinfoMediaBundle(),
            new Stfalcon\Bundle\TinymceBundle\StfalconTinymceBundle(),
            # sylius
            new Librinfo\SonataSyliusUserBundle\SonataSyliusUserBundle(),
        ];

app\config\routing.yml

app:
    resource: '@AppBundle/Controller/'
    type: annotation
    
admin:
    resource: '@SonataAdminBundle/Resources/config/routing/sonata_admin.xml'
    prefix: /admin

_sonata_admin:
    resource: .
    type: sonata_admin
    prefix: /admin

blast_core:
    resource: "@BlastCoreBundle/Resources/config/routing.yml" 
    prefix:   /admin
librinfo_media:
    resource: "@LibrinfoMediaBundle/Resources/config/routing.yml"
bin/console blast:generate:extension-containers -d

src\AppBundle\Entity\LibreVarietiesBundle\VarietyExtension.php

<?php

namespace AppBundle\Entity\OuterExtension\LibrinfoVarietiesBundle;

trait VarietyExtension
{
    use \Librinfo\MediaBundle\Entity\OuterExtension\HasImages;
}

app\config\services.yml

services:
    sylius.canonicalizer:
        class: Sylius\Component\User\Canonicalizer\Canonicalizer

generate database tables

bin/console doctrine:schema:create