2017 © Pedro Peláez
 

symfony-bundle common-bundle

A collection of classes commonly used throughout my projects

image

belsym/common-bundle

A collection of classes commonly used throughout my projects

  • Friday, August 2, 2013
  • by beldougie
  • Repository
  • 1 Watchers
  • 1 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

CommonBundle

A collection of classes commonly used throughout my projects, (*1)

PLEASE NOTE:

This package is currently broken. It's experimental and in the very early stages of development so please don't use it if your project is critical... it's no good for that!, (*2)

If you want to make suggestions though or get involved, you're welcome to. Give me a shout., (*3)

Features

Entities

This bundle incorporates stof\DoctrineExtensionsBundle and doctrine\DoctrineFixturesBundle to make working with entities slightly easier., (*4)

The entities included are:, (*5)

BaseEntity

Useful class that adds a standard, integer-based id field and timestampable behaviour on insert and update, (*6)

How to use

TODO, (*7)

BaseUser

A class that adds basic information about a person. Firstname, lastname and date of birth fields are added to any Entity extending from this class., (*8)

How to use

TODO, (*9)

BaseLookup

There are issues in using Enums in a sqlite database. Mainly because it doesn't support an Enum or anything like it..., (*10)

So, the BaseLookup makes it easy to add lookup or reference tables to your database as related entities., (*11)

How to use

TODO, (*12)

DBAL Types

EnumType

TODO, (*13)

Abstract TestCases

BaseDatabaseTestCase

TODO, (*14)

BaseFixtureLoadingTestCase

TODO, (*15)

Installation

Obtain the Bundle

add the requirement to your composer.json, (*16)

{
    "require": {
        "beldougie/beldougie-common-bundle": "*"
    }
}

Add Bundles to the application kernel

// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        //..
        new Symfony\Bundle\DoctrineFixturesBundle\DoctrineFixturesBundle(),
        new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
        new Beldougie\CommonBundle\BeldougieCommonBundle(),
        //..
    )
 }

Configure the bundle

At present, the only configuration options necessary to add are those for Timestampable from the stof\DoctrineExtensionsBundle, (*17)

You must activate timestampable as the abstract entities included in this bundle use Timestampable in their annotated configuration., (*18)

For more detailed information about using other aspects of the DoctrineExtensionsBundle see the documentation, (*19)

Timestampable

# Stof Doctrine Extensions
stof\_doctrine\_extensions:
    orm:
        default:
            timestampable: true

Testing

NB: This section is only relevant if you need to run the BeldougieCommon tests directly within your application for some reason, for example to if you have configuration issues or you want to work on the bundles., (*20)

IMPORTANT!

If you run the tests without having configured a test database, you WILL destroy ALL of your data irrecoverably., (*21)

Configure the test environment

By default, phpunit will only run tests located in the src/ folder. For this reason, if you don't want to run the tests you don't need to ready any further., (*22)

Due to the nature of this bundle the tests included rely on a database. They utilise data fixtures and load automatically when run. Each setup will generate the schema while each teardown DROPS the schema., (*23)

We recommend copying phpunit.xml.dist to phpunit.xml and making these changes there. If you add phpunit.xml to .gitignore, it will not get saved in git and the tests will only get run locally on your system and not in a deployment or CI process., (*24)

Add the tests to your phpunit configuration

<testsuites>
    <testsuite name="Project Test Suite">
        <!-- .... -->
        <directory>../vendor/beldougie/beldougie-*-bundle/Beldougie/*Bundle/Tests</directory>
        <!-- .... -->
    </testsuite>
</testsuites>

Note the "*" wildcard. Currently, My other bundle(s) use the same naming configuration, so you will only need to do this once., (*25)

Configure an in-memory database

In your app/config/config_test.yml, add the following, (*26)

// app/config/config_test.yml
doctrine:
    dbal:
        driver:   pdo_sqlite
        host:     localhost
        dbname:   db_test
        user:     db_user
        charset:  UTF8
        password: db_pwd
        memory:   true
    orm:
        auto_generate_proxy_classes: true

The Versions

02/08 2013

dev-master

9999999-dev https://github.com/beldougie/CommonBundle

A collection of classes commonly used throughout my projects

  Sources   Download

MIT

The Requires

 

by Matt Keeble

abstract doctrine2 entities doctrine-extensions doctrine-fixtures