Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: jasonmoo/DumbledORM
base: a03846ca48
...
head fork: jasonmoo/DumbledORM
compare: de6d46f822
Checking mergeability… Don't worry, you can still create the pull request.
  • 3 commits
  • 3 files changed
  • 0 commit comments
  • 2 contributors
Commits on May 11, 2012
nico Enabled mysql server port congiguration as per jasonmoo/DumbledORM#1
…requested by jiminoc
26182f4
nico Added a PHP-CLI script to generate the models via the command line. Run
Generate DumbledORM models.

  Usage:
  ./generate.php <option>

  <option>
      -h, -?, --help, -help            Print this help message
      -p, --prefix <prefix>            Prefix generated classes
      -d, --dir <directory>            Output directory for the model instead of the default ./model  to see usage instructions.
76c7d8f
@jasonmoo Merge pull request #2 from nickl-/master
"in any case": Effortless contributions
de6d46f
Showing with 30 additions and 1 deletion.
  1. +1 −0  config.php
  2. +1 −1  dumbledorm.php
  3. +28 −0 generate.php
View
1  config.php
@@ -1,6 +1,7 @@
<?php
class DbConfig {
const HOST = 'localhost';
+ const PORT = 3306;
const DBNAME = 'test_database';
const USER = 'root';
const PASSWORD = 'password';
View
2  dumbledorm.php
@@ -141,7 +141,7 @@ public static function generateBase($prefix=null,$dir='model') {
*/
public static function pdo() {
if (!self::$_pdo) {
- self::$_pdo = new PDO('mysql:host='.DbConfig::HOST.';dbname='.DbConfig::DBNAME, DbConfig::USER, DbConfig::PASSWORD);
+ self::$_pdo = new PDO('mysql:host='.DbConfig::HOST.';port='.DbConfig::PORT.';dbname='.DbConfig::DBNAME, DbConfig::USER, DbConfig::PASSWORD);
self::$_pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
return self::$_pdo;
View
28 generate.php
@@ -0,0 +1,28 @@
+#!/usr/bin/php
+<?php
+if (in_array($argv[1], array('--help', '-help', '-h', '-?'))) {
+?>
+
+Generate DumbledORM models.
+
+ Usage:
+ <?php echo $argv[0]; ?> <option>
+
+ <option>
+ -h, -?, --help, -help Print this help message
+ -p, --prefix <prefix> Prefix generated classes
+ -d, --dir <directory> Output directory for the model instead of the default ./model
+
+<?php
+} else {
+$params = array(
+ 'p:' => 'prefix:',
+ 'd:' => 'dir:',
+);
+$opt = getopt(implode('', array_keys($params)), $params);
+
+require('config.php');
+require('dumbledorm.php');
+Builder::generateBase($opt['p'], ($opt['d'] ? $opt['d'] : 'model'));
+}
+?>

No commit comments for this range

Something went wrong with that request. Please try again.