[Beeframework-svn] SF.net SVN: beeframework:[32] trunk/examples
Brought to you by:
b_hartmann,
m_plomer
From: <m_p...@us...> - 2013-05-07 11:16:03
|
Revision: 32 http://sourceforge.net/p/beeframework/code/32 Author: m_plomer Date: 2013-05-07 11:15:59 +0000 (Tue, 07 May 2013) Log Message: ----------- - pdo ordering examples Modified Paths: -------------- trunk/examples/classes/Persistence/Pdo/OrderedColorsDao.php trunk/examples/index.php Modified: trunk/examples/classes/Persistence/Pdo/OrderedColorsDao.php =================================================================== --- trunk/examples/classes/Persistence/Pdo/OrderedColorsDao.php 2013-05-07 11:13:57 UTC (rev 31) +++ trunk/examples/classes/Persistence/Pdo/OrderedColorsDao.php 2013-05-07 11:15:59 UTC (rev 32) @@ -61,6 +61,19 @@ } /** + * + */ + public function createTable() { + $this->pdoConnection->exec('CREATE TABLE "ordered_colors" ( + "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, + "name" text NOT NULL, + "hex_value" text NOT NULL, + "pos" integer DEFAULT NULL, + UNIQUE (pos ASC) + )'); + } + + /** * @return \Bee\Persistence\Behaviors\Ordered\Strategy */ public function getOrderedStrategy() { Modified: trunk/examples/index.php =================================================================== --- trunk/examples/index.php 2013-05-07 11:13:57 UTC (rev 31) +++ trunk/examples/index.php 2013-05-07 11:15:59 UTC (rev 32) @@ -38,17 +38,10 @@ $ctx = new Bee_Context_Xml('conf/context.xml'); -$pdoConn = $ctx->getBean('pdoConnection'); -$pdoConn->exec('CREATE TABLE "ordered_colors" ( - "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, - "name" text NOT NULL, - "hex_value" text NOT NULL, - "pos" integer DEFAULT NULL, - UNIQUE (pos ASC) -)'); - $dao = $ctx->getBean('orderedColorsDao'); +$dao->createTable(); + $dao->addColor('Red', '#ff0000'); $greenId = $dao->addColor('Green', '#00ff00'); $dao->addColor('Blue', '#0000ff'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |