2017 © Pedro Peláez
 

project silex-orm-skeleton

A pre-configured skeleton for the Silex microframework with doctrine ORM and bootstrap config.

image

fredjuvaux/silex-orm-skeleton

A pre-configured skeleton for the Silex microframework with doctrine ORM and bootstrap config.

  • Tuesday, August 18, 2015
  • by fredjuvaux
  • Repository
  • 1 Watchers
  • 14 Stars
  • 3 Installations
  • HTML
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 2 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

silex-orm-skeleton

Silex skeleton with doctrine ORM, bootstrap and CRUD example., (*1)

For doctrine documentation see symfony and doctrine docs., (*2)

Install:, (*3)

cd /path/to/your_project
git clone git@github.com:fredjuvaux/silex-orm-skeleton.git

Install composer:, (*4)

curl -s https://getcomposer.org/installer | php

More information on Composer can be found on getcomposer.org., (*5)

And install your dependencies:, (*6)

php composer.phar install

Set your database information in src/app.php:, (*7)

$app->register(new DoctrineServiceProvider(), array(
    'db.options' => array(
        'driver'        => 'pdo_mysql',
        'host'          => 'localhost',
        'dbname'        => 'xxx',
        'user'          => 'xxx',
        'password'      => 'xxx',
    ),
));

Create database, then generate tables with CLI tool (for acme demo by example):, (*8)

php bin/console orm:schema-tool:update --force

Commands available:, (*9)

php bin/console --info
Available commands:
  help                             Displays help for a command
  list                             Lists commands
dbal
  dbal:import                      Import SQL file(s) directly to Database.
  dbal:reserved-words              Checks if the current database contains identifiers that are reserved.
  dbal:run-sql                     Executes arbitrary SQL directly from the command line.
orm
  orm:clear-cache:metadata         Clear all metadata cache of the various cache drivers.
  orm:clear-cache:query            Clear all query cache of the various cache drivers.
  orm:clear-cache:result           Clear result cache of the various cache drivers.
  orm:convert-d1-schema            Converts Doctrine 1.X schema into a Doctrine 2.X schema.
  orm:convert-mapping              Convert mapping information between supported formats.
  orm:ensure-production-settings   Verify that Doctrine is properly configured for a production environment.
  orm:generate-entities            Generate entity classes and method stubs from your mapping information.
  orm:generate-proxies             Generates proxy classes for entity classes.
  orm:generate-repositories        Generate repository classes from your mapping information.
  orm:info                         Show basic information about all mapped entities
  orm:run-dql                      Executes arbitrary DQL directly from the command line.
  orm:schema-tool:create           Processes the schema and either create it directly on EntityManager Storage Connection or generate the SQL output.
  orm:schema-tool:drop             Drop the complete database schema of EntityManager Storage Connection or generate the corresponding SQL output.
  orm:schema-tool:update           Executes (or dumps) the SQL needed to update the database schema to match the current mapping metadata.
  orm:validate-schema              Validate that the mapping files.

Example:, (*10)

php bin/console orm:generate-entities src

Acme CRUD demo routes:, (*11)

/path/to/your_project/acme/
/path/to/your_project/acme/create
/path/to/your_project/acme/show/{id}
/path/to/your_project/acme/update/{id}
/path/to/your_project/acme/delete/{id}

The Versions