Skip to content

Commit

Permalink
Merge branch 'develop' into autoload
Browse files Browse the repository at this point in the history
  • Loading branch information
opengeek committed May 8, 2012
2 parents 80772da + 0c839d4 commit 328b0bc
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 13 deletions.
5 changes: 3 additions & 2 deletions test/model/sample/sqlite/xpdosample.map.inc.php
Expand Up @@ -18,7 +18,7 @@
'password' => NULL,
'integer' => NULL,
'float' => '1.01230',
'boolean' => 0,
'boolean' => NULL,
),
'fieldMeta' =>
array (
Expand Down Expand Up @@ -107,13 +107,13 @@
'precision' => '1',
'phptype' => 'boolean',
'null' => false,
'default' => 0,
),
),
'indexes' =>
array (
'PRIMARY' =>
array (
'alias' => 'PRIMARY',
'primary' => true,
'unique' => true,
'columns' =>
Expand All @@ -125,6 +125,7 @@
),
'unique_varchar' =>
array (
'alias' => 'unique_varchar',
'primary' => false,
'unique' => true,
'columns' =>
Expand Down
3 changes: 1 addition & 2 deletions test/model/sample/sqlsrv/xpdosample.map.inc.php
Expand Up @@ -18,7 +18,7 @@
'password' => NULL,
'integer' => NULL,
'float' => 1.0123,
'boolean' => 0,
'boolean' => NULL,
),
'fieldMeta' =>
array (
Expand Down Expand Up @@ -105,7 +105,6 @@
'dbtype' => 'bit',
'phptype' => 'boolean',
'null' => false,
'default' => 0,
),
),
'indexes' =>
Expand Down
10 changes: 5 additions & 5 deletions test/model/schema/sample.sqlite.schema.xml
Expand Up @@ -66,12 +66,12 @@
<field key="password" dbtype="varchar" phptype="password" null="false" />
<field key="integer" dbtype="int" phptype="integer" null="false" />
<field key="float" dbtype="decimal" precision="10,5" phptype="float" null="false" default="1.01230" />
<field key="boolean" dbtype="tinyint" precision="1" phptype="boolean" null="false" default="0" />
<field key="boolean" dbtype="tinyint" precision="1" phptype="boolean" null="false" />

<index name="PRIMARY" primary="true" unique="true">
<index alias="PRIMARY" name="PRIMARY" primary="true" unique="true">
<column key="id" />
</index>
<index name="unique_varchar" primary="false" unique="true">
<index alias="unique_varchar" name="unique_varchar" primary="false" unique="true">
<column key="unique_varchar" />
</index>
</object>
Expand All @@ -92,10 +92,10 @@
<field key="date_modified" dbtype="timestamp" phptype="timestamp" null="false" default="CURRENT_TIMESTAMP" />
</object>

<index name="name" primary="false" unique="true">
<index alias="name" name="name" primary="false" unique="true">
<column key="name" length="" collation="A" null="false" />
</index>
<index name="color" primary="false" unique="false">
<index alias="color" name="color" primary="false" unique="false">
<column key="color" length="" collation="A" null="false" />
</index>
<object class="implicit.subpkg.xPDOSubSample" table="xpdosubsample" extends="xPDOSample">
Expand Down
2 changes: 1 addition & 1 deletion test/model/schema/sample.sqlsrv.schema.xml
Expand Up @@ -59,7 +59,7 @@
<field key="password" dbtype="varchar" phptype="password" null="false" />
<field key="integer" dbtype="int" phptype="integer" null="false" />
<field key="float" dbtype="decimal" precision="(10,5)" phptype="float" null="false" default="1.01230" />
<field key="boolean" dbtype="bit" phptype="boolean" null="false" default="0" />
<field key="boolean" dbtype="bit" phptype="boolean" null="false" />

<index name="unique_varchar" primary="false" unique="true">
<column key="unique_varchar" />
Expand Down
8 changes: 5 additions & 3 deletions test/xPDO/xPDO/xPDO.php
Expand Up @@ -339,7 +339,7 @@ public function testGetFields($class,array $correctFields = array()) {
$diff = array_diff($fields,$correctFields);
$diff2 = array_diff($correctFields,$fields);
$success = is_array($fields) && empty($diff) && empty($diff2);
$this->assertTrue($success);
$this->assertEquals($correctFields, $fields);
}
/**
* Data provider for testGetFields
Expand All @@ -361,6 +361,7 @@ public function providerGetFields() {
'security_level' => 1,
)),
array('xPDOSample', array(
'id' => NULL,
'parent' => 0,
'unique_varchar' => NULL,
'varchar' => NULL,
Expand All @@ -372,10 +373,11 @@ public function providerGetFields() {
'enum' => NULL,
'password' => NULL,
'integer' => NULL,
'float' => 1.0123,
'float' => 1.01230,
'boolean' => NULL,
)),
array('implicit.subpkg.xPDOSubSample', array(
'id' => NULL,
'parent' => 0,
'unique_varchar' => NULL,
'varchar' => NULL,
Expand All @@ -387,7 +389,7 @@ public function providerGetFields() {
'enum' => NULL,
'password' => NULL,
'integer' => NULL,
'float' => 1.0123,
'float' => 1.01230,
'boolean' => NULL,
'another_integer' => NULL
)),
Expand Down
1 change: 1 addition & 0 deletions xpdo/changelog.txt
@@ -1,5 +1,6 @@
This file shows the changes in this release of xPDO.

- Prefix indexes with table name for sqlite
- Fix lazy loading of fields on demand
- [#7607] xPDOObject->get(array) triggering invalid lazy loading
- xPDOObject/xPDOSimpleObject support for xPDO::getDescendants()
Expand Down
1 change: 1 addition & 0 deletions xpdo/om/sqlite/xpdomanager.class.php
Expand Up @@ -120,6 +120,7 @@ public function createObjectContainer($className) {
$tableConstraints = array();
if (!empty ($indexes)) {
foreach ($indexes as $indexkey => $indexdef) {
$indexkey = $this->xpdo->literal($instance->_table) . '_' . $indexkey;
$indexType = ($indexdef['primary'] ? 'PRIMARY KEY' : ($indexdef['unique'] ? 'UNIQUE' : 'INDEX'));
$index = $indexdef['columns'];
if (is_array($index)) {
Expand Down

0 comments on commit 328b0bc

Please sign in to comment.