madebydavid/silex-skeleton-orm

This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.
There is no license information available for the latest version (v2.0) of this package.

Skeleton Silex app with ORM and cli tool for generating model and schema

v2.0 2014-09-02 16:52 UTC

This package is not auto-updated.

Last update: 2021-07-23 23:38:10 UTC


README

A simple Silex skeleton project with Twig, Doctrine, ORM, Bootstrap, jQuery and other common components.

To view the full list of dependancies, have a look at the composer.json file.

Based on Fabien Potencier's Silex Skeleton, but with more up to date dependencies and a different structure.

To install with composer

1. Install composer if you don't have it already:

$ curl -sS https://getcomposer.org/installer | php

2. Grab this project as your base

$ php composer.phar create-project madebydavid/silex-skeleton-orm silex-project
$ cd silex-project

3. Configure the database in the dev config file:

$app['config'] = array(
    'db.options' => array(
        'driver'    => 'pdo_mysql',
        'dbname'    => 'skeleton-dev',
        'user'      => 'root',
        'password'  => ''
    )
);

4. Create the database which you have just configured:

$ mysqladmin -uroot create skeleton-dev

5. Create your model

You can create your model with Doctrine YAML documents in the config/doctrine/schema directory, make a new file called Model.EntityName.dcm.yml for each entity:

#config/doctrine/schema/Model.Person.dcm.yml
Model\Person:
    type: entity
    table: person
    fields:
        id:
            type: integer
            id: true
            generator:
                strategy: AUTO
        name:
            type: string
            length: 255
        created:
            type: datetime
            columnDefinition: TIMESTAMP DEFAULT CURRENT_TIMESTAMP

6. Generate the Entity classes from the YAML:

$ ./console orm:generate-entities src/

7. Create the schema:

$ ./console orm:schema-tool:create