2017 © Pedro Peláez
 

library doctrine-db-patcher

Doctrine-DB-Patcher

image

cyberrebell/doctrine-db-patcher

Doctrine-DB-Patcher

  • Friday, June 20, 2014
  • by Cyberrebell
  • Repository
  • 2 Watchers
  • 0 Stars
  • 16 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

doctrine-db-patcher

Gives your ZF2+Doctrine-Project a toolset for database-patches., (*1)

===================, (*2)

DoctrineDbPatcher

Requirents:

php >=5.4, (*3)

ZF2: https://github.com/zendframework/zf2, (*4)

DoctrineMongoODMModule: https://github.com/doctrine/DoctrineMongoODMModule, (*5)

or, (*6)

DoctrineORMModule: https://github.com/doctrine/DoctrineORMModule, (*7)

Installation via composer:

add to composer.json:, (*8)

    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/Cyberrebell/doctrine-db-patcher"
        }
    ],
    "require": {
        "Cyberrebell/doctrine-db-patcher": "dev-master"
    },

Configuration in project:

add to application.config.php:, (*9)

return [
    'modules' => [
        'DoctrineDbPatcher'
    ]
];

add to any module.config.php:, (*10)

return [
    'DoctrineDbPatcher' => [
        'doctrine-objectmanager-service' => 'Doctrine\ODM\Mongo\DocumentManager', //or Doctrine\ORM\EntityManager
        'patches' => include 'doctrine.patches.php'
    ]
];

create doctrine.patches.php and add your patches like this:, (*11)

<?php 
return [
    '1.0.0' => [
        'insert' => [
            'User\Entity\Resource' => [
                'attributes' => ['route'],
                'values' => [
                    ['login'],
                    ['logout'],
                ]
            ],
            'User\Entity\Permission' => [
                'attributes' => ['description'],
                'values' => [
                    ['Sich einloggen'],
                    ['Sich ausloggen'],
                ]
            ],
        ],
        'update' => [
             'User\Entity\Guestbook' => [
                 [
                     'attributes' => ['title'],
                     'values' => [
                         ['old' => ['This is a niec website'], 'new' => ['This is a nice website']],
                     ]
                 ],
             ],
        ],
        'delete' => [
             'User\Entity\Guestbook' => [
                 [
                     'attributes' => ['title'],
                     'values' => [
                         ['Hello everyone'],
                     ]
                 ],
             ],
        ],
        'connect' => [
            [
                'entities' => ['User\Entity\Permission' => 'User\Entity\Resource'],
                'methods' => ['addResource' => 'removeResource'],
                'targets' => [
                    ['source' => ['description' => 'Sich einloggen'], 'target' => ['route' => 'login']],
                    ['source' => ['description' => 'Sich ausloggen'], 'target' => ['route' => 'logout']],
                ]
            ]
        ]
    ]
];

Configuration in project:

run the patch-tool:, (*12)

php public/index.php dbpatch

The Versions

20/06 2014

dev-master

9999999-dev https://github.com/Cyberrebell/doctrine-db-patcher

Doctrine-DB-Patcher

  Sources   Download

GPL-2.0

The Requires

 

by Avatar Cyberrebell

zf2 doctrine odm patch