2017 © Pedro Peláez
 

symfony-bundle doctrine-yuml-bundle

Symfony Bundle to visualize the mapping of your entities with Yuml

image

onurb/doctrine-yuml-bundle

Symfony Bundle to visualize the mapping of your entities with Yuml

  • Thursday, February 22, 2018
  • by nono1971
  • Repository
  • 1 Watchers
  • 16 Stars
  • 8,331 Installations
  • PHP
  • 0 Dependents
  • 2 Suggesters
  • 6 Forks
  • 0 Open issues
  • 15 Versions
  • 17 % Grown

The README.md

doctrine-yuml-bundle

Build Status Scrutinizer Code Quality Code Coverage Build Status License Latest Stable Version Total Downloads Monthly Downloads Daily Downloads, (*1)

Bundle to visualise doctrine entities graph with yuml in Symfony4, (*2)

This bundle is based on Marco Pivetta's work for zend doctrine ORM Module and zend developper tools, (*3)

It uses the yuml.me api to display your project's objects mapping., (*4)

Installation

Symfony 4

Run the composer require onurb/doctrine-yuml-bundle command in your console, (*5)

Adjust your parameters to personalize the render in config/packages/dev/yuml.yaml, or use annotations as describe bellow, (*6)

Adjust the route (if you want to add a prefix) in config/routes/dev/yuml.yaml, (*7)

Symfony 3

symfony 3 is not supported since 1.1.6, if you didn't migrate to SF4 yet, use version 1.1.5, (*8)

  • Add this bundle to your project as a composer dependency:
    // composer.json
    {
        // ...
        require: {
            // ...
            "onurb/doctrine-yuml-bundle": "1.1.5"
        }
    }
  • Declare the bundle in your application kernel:
    // app/AppKernel.php
    public function registerBundles()
    {
        // ...
        if (in_array($this->getEnvironment(), array('dev', 'test'))) {
            // ...

            $bundles[] = new Onurb\Bundle\YumlBundle\OnurbYumlBundle();
        }
        return $bundles;
    }
  • Add this route in your global routing_dev configuration (with optional prefix)
    # app/config/routing_dev.yml

    # ...
    doctrine_yuml:
        resource: "@OnurbYumlBundle/Resources/config/routing.yml"
        prefix:   /my_prefix/

configure access to the yuml route (if you use security of course), (*9)

Use

Click on Doctrine icon added in the dev toolbar., (*10)

Run the yuml:mappings console command to save the image locally., (*11)

Personalize the render

Full personalisation for mapping rendering, defining parameters or using Metadatagrapher annotations Colored Map with note, (*12)

define the output file extension

Use the parameter file :, (*13)

     # app/config/parameters.yml        => symfony 3
     # config/packages/dev/yuml.yaml    => symfony 4

    parameters:
        onurb_yuml.extension: svg
        # ...

Extensions allowed : jpg, png (default), svg, pdf, or json, (*14)

define the yuml rendering style

Use the parameter file :, (*15)

     # app/config/parameters.yml        => symfony 3
     # config/packages/dev/yuml.yaml    => symfony 4

    parameters:
        onurb_yuml.style: scruffy
        # ...

Styles allowed : plain (default), boring or scruffy, (*16)

define the graph direction

Use the parameter file :, (*17)

     # app/config/parameters.yml        => symfony 3
     # config/packages/dev/yuml.yaml    => symfony 4

    parameters:
        onurb_yuml.direction: LR
        # ...

Directions allowed : LR (left to Right), RL (Right to Left), TB (Top to bottom => default)., (*18)

define the graph scale

Use the parameter file :, (*19)

     # app/config/parameters.yml        => symfony 3
     # config/packages/dev/yuml.yaml    => symfony 4

    parameters:
        onurb_yuml.scale: huge
        # ...

Scales allowed : huge, big, normal (default), small or tiny., (*20)

Hide entities attributes properties (unique, type, length, ...)

Use the parameter file :, (*21)

     # app/config/parameters.yml        => symfony 3
     # config/packages/dev/yuml.yaml    => symfony 4

    parameters:
        onurb_yuml.show_fields_description: false
        # ...

this parameter is set to true by default since v1.1, (*22)

Warning : In Symfony 3, don't forget to also define parameter keys in parameters.yml.dist to avoid symfony update

to clear your parameters, (*23)

Toggle attributes properties on a specific class using annotations

to show only desired classes details if global parameter is set to false :, (*24)

    namespace My\Bundle\Entity

    use Onurb\Doctrine\ORMMetadataGrapher\Mapping as Grapher;

    /**
    * @Grapher\ShowAttributesProperties()
    */
    Class MyClass
    {
        // ...
    }

And, if set to true (default), you can hide properties for a specific class :, (*25)

    namespace My\Bundle\Entity

    use Onurb\Doctrine\ORMMetadataGrapher\Mapping as Grapher;

    /**
    * @Grapher\HideAttributesProperties()
    */
    Class MyClass
    {
        // ...
    }

Define colors for entities rendering

Define default color for a complete bundle or namespace by defining it in parameters.yml

     # app/config/parameters.yml        => Symfony 3
     # config/packages/dev/yuml.yaml    => Symfony 4

    parameters:
        onurb_yuml.colors:
            App\Security: red
            App\Blog: blue
        # ...

You can also define colors for classes this way... but it is easier using annotations as described next, (*26)

Complete list of yuml colors availables here Color list, (*27)

Define Entity color in graph using annotations

    namespace My\Bundle\Entity

    use Onurb\Doctrine\ORMMetadataGrapher\Mapping as Grapher;

    /**
    * @Grapher\Color("blue")
    */
    Class MyClass
    {

    }

Display specific entity method

You can display specific methods in the graph, using annotations, (*28)

    namespace My\Bundle\Entity

    use Onurb\Doctrine\ORMMetadataGrapher\Mapping as Grapher;

    // ...
    Class MyEntity
    {
        // ...

        /**
         * @Grapher\IsDisplayedMethod()
         */
        public function myDisplayedMethod()
        {
            // ...
        }
    }

Hide columns

Hide all columns of the entity

If you want, you can hide Entity attributes with annotations : using annotation on the class :, (*29)

/**
* @Grapher\Hidecolumns
*/
MyEntity
{
    //[...]
}

Hide specific column

Or hide a specific secret column you want to hide, using annotation on the Entity column : (it could be usefull to hide you credential logic, or to avoid the display recurrent fields, like created_at, or updated_at in the graph...), (*30)

MyEntity
{
    /**
     * @ORM\Column(/* ... */)
     * @Grapher\HiddenColumn
     */
    private $secret;
}

Add notes to comment entities in the graph

use annotations :, (*31)

    namespace My\Bundle\Entity

    use Onurb\Doctrine\ORMMetadataGrapher\Mapping as Grapher;

    /**
    * @Grapher\Note("Some information about this class")
    */
    Class MyClass
    {

    }

Notes are yellow by default, but you can customize note's' color, (*32)

    /**
    * @Grapher\Note(value="Some information about this class", color="blue")
    */

The Versions

13/02 2018

1.1.1

1.1.1.0

Symfony Bundle to visualize the mapping of your entities with Yuml

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bruno Heron

bundle doctrine symfony graph mapping uml diagram yuml

11/02 2018

1.1

1.1.0.0

Symfony Bundle to visualize the mapping of your entities with Yuml

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bruno Heron

bundle doctrine symfony graph mapping uml diagram yuml

14/07 2016

1.0.1

1.0.1.0

Symfony3 Bundle to view Doctrine mapping with Yuml

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bruno Heron

bundle doctrine symfony graph mapping uml diagram yuml

03/07 2016

1.0.0.1

1.0.0.1

Symfony2 Bundle to view Doctrine mapping with Yuml

  Sources   Download

MIT

The Requires

 

by Bruno Heron

bundle doctrine symfony graph mapping uml diagram yuml

07/03 2016

1.0

1.0.0.0

Symfony2 Bundle to view Doctrine mapping with Yuml

  Sources   Download

MIT

The Requires

 

by Bruno Heron

bundle doctrine symfony graph mapping uml diagram yuml