PHP code example of josiah / doctrine-schema-builder
1. Go to this page and download the library: Download josiah/doctrine-schema-builder library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
josiah / doctrine-schema-builder example snippets
use Doctrine\DBAL\Schema\Builder;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\Table;
$schema = new Schema();
$builder = new Builder($schema);
$builder
// Create table if it doesn't exist, do nothing if it does
->createTable('foo', function (Table $table) {
$table->addColumn('id', 'integer')
->setNotNull(true)
->setUnsigned(true)
->setAutoIncrement(true)
->setComment("Unique Identifier, DUH!");
$table->addColumn('name', 'string')
->setNotNull(true);
$table->setPrimaryKey(['id']);
// ... you get the picture.
})
// Overwrite table if it exists, create it if it doesnt
->defineTable('bar', function (Table $table) {
// ... more definition like before
})
// Drop table if it exists, do nothing if it doesnt
->dropTable('baz');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.