Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
e354e527
Commit
e354e527
authored
Feb 16, 2008
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small refactorings
parent
be5aac16
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
36 additions
and
39 deletions
+36
-39
ClassMetadata.php
lib/Doctrine/ClassMetadata.php
+12
-13
AccessTest.php
tests/Orm/Component/AccessTest.php
+7
-9
AllTests.php
tests/Orm/Component/AllTests.php
+3
-3
CollectionTest.php
tests/Orm/Component/CollectionTest.php
+1
-1
CustomPK.php
tests_old/models/CustomPK.php
+1
-1
Email.php
tests_old/models/Email.php
+3
-3
EntityReference.php
tests_old/models/EntityReference.php
+2
-2
Error.php
tests_old/models/Error.php
+1
-1
MysqlTestRecord.php
tests_old/models/MysqlTestRecord.php
+2
-2
NestReference.php
tests_old/models/NestReference.php
+2
-2
NotNullTest.php
tests_old/models/NotNullTest.php
+2
-2
No files found.
lib/Doctrine/ClassMetadata.php
View file @
e354e527
...
...
@@ -480,25 +480,24 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
}
/**
*
addMappedColumn
*
Maps a column of the class' database table to a property of the entity.
*
* @param string $name
* @param string $type
* @param integer $length
* @param string $name The name of the column to map. Syntax: columnName [as propertyName].
* The property name is optional. If not used the column will be
* mapped to a property with the same name.
* @param string $type The type of the column.
* @param integer $length The length of the column.
* @param mixed $options
* @param boolean $prepend Whether to prepend or append the new column to the column list.
* By default the column gets appended.
* @param boolean $prepend Whether to prepend or append the new column to the column list.
* By default the column gets appended.
*
* @throws Doctrine_ClassMetadata_Exception If trying use wrongly typed parameter.
*/
public
function
mapColumn
(
$name
,
$type
,
$length
=
null
,
$options
=
array
(),
$prepend
=
false
)
{
if
(
is_string
(
$options
))
{
$options
=
explode
(
'|'
,
$options
);
}
foreach
(
$options
as
$k
=>
$option
)
{
if
(
is_numeric
(
$k
))
{
if
(
!
empty
(
$option
))
{
if
(
!
empty
(
$option
)
&&
$option
!==
false
)
{
$options
[
$option
]
=
true
;
}
unset
(
$options
[
$k
]);
...
...
@@ -598,7 +597,7 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
/**
* hasDefaultValues
* returns true if this
table
has default values, otherwise false
* returns true if this
class
has default values, otherwise false
*
* @return boolean
*/
...
...
@@ -609,7 +608,7 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
/**
* getDefaultValueOf
* returns the default value(if any) for given
column
* returns the default value(if any) for given
field
*
* @param string $fieldName
* @return mixed
...
...
tests/Orm/Component/AccessTest.php
View file @
e354e527
...
...
@@ -20,8 +20,7 @@
*/
/**
* Doctrine
* the base class of Doctrine framework
* Testcase for basic accessor/mutator functionality.
*
* @package Doctrine
* @author Bjarte Stien Karlsen <doctrine@bjartek.org>
...
...
@@ -32,6 +31,8 @@
*/
require_once
'lib/DoctrineTestInit.php'
;
class
AccessStub
extends
Doctrine_Access
{}
class
Orm_Component_AccessTest
extends
Doctrine_OrmTestCase
{
...
...
@@ -66,7 +67,7 @@ class Orm_Component_AccessTest extends Doctrine_OrmTestCase
*/
public
function
shouldSetSingleValueInRecord
()
{
$this
->
user
->
username
=
'meus'
;
$this
->
user
->
username
=
'meus'
;
$this
->
assertEquals
(
'meus'
,
$this
->
user
->
username
);
$this
->
assertEquals
(
'meus'
,
$this
->
user
[
'username'
]);
}
...
...
@@ -106,7 +107,7 @@ class Orm_Component_AccessTest extends Doctrine_OrmTestCase
*/
public
function
shouldNotBeAbleToSetNonExistantField
()
{
$this
->
user
->
rat
=
'meus'
;
$this
->
user
->
rat
=
'meus'
;
}
/**
...
...
@@ -115,7 +116,7 @@ class Orm_Component_AccessTest extends Doctrine_OrmTestCase
*/
public
function
shouldNotBeAbleToSetNonExistantFieldWithOffset
()
{
$this
->
user
[
'rat'
]
=
'meus'
;
$this
->
user
[
'rat'
]
=
'meus'
;
}
/**
...
...
@@ -126,7 +127,7 @@ class Orm_Component_AccessTest extends Doctrine_OrmTestCase
{
$this
->
user
->
setArray
(
array
(
'rat'
=>
'meus'
,
'id'
=>
22
));
'id'
=>
22
));
}
...
...
@@ -139,7 +140,6 @@ class Orm_Component_AccessTest extends Doctrine_OrmTestCase
$col
=
new
Doctrine_Collection
(
'ForumUser'
);
$this
->
assertEquals
(
0
,
count
(
$col
));
$this
->
assertFalse
(
isset
(
$coll
[
0
]));
$this
->
assertFalse
(
isset
(
$coll
[
0
]));
}
/**
...
...
@@ -218,5 +218,3 @@ class Orm_Component_AccessTest extends Doctrine_OrmTestCase
$stub
[
'foo'
];
}
}
class
AccessStub
extends
Doctrine_Access
{}
tests/Orm/Component/AllTests.php
View file @
e354e527
...
...
@@ -21,9 +21,9 @@ class Orm_Component_AllTests
{
$suite
=
new
Doctrine_TestSuite
(
'Doctrine Orm Component'
);
//
$suite->addTestSuite('Orm_Component_TestTest');
$suite
->
addTestSuite
(
'Orm_Component_AccessTest'
);
$suite
->
addTestSuite
(
'Orm_Component_CollectionTest'
);
//
$suite->addTestSuite('Orm_Component_TestTest');
$suite
->
addTestSuite
(
'Orm_Component_AccessTest'
);
$suite
->
addTestSuite
(
'Orm_Component_CollectionTest'
);
return
$suite
;
}
...
...
tests/Orm/Component/CollectionTest.php
View file @
e354e527
...
...
@@ -98,7 +98,7 @@ class Orm_Component_CollectionTest extends Doctrine_OrmTestCase
{
$serializedFormCollection
=
'C:19:"Doctrine_Collection":158:{a:7:{s:4:"data";a:0:{}s:7:"_mapper";s:9:"ForumUser";s:9:"_snapshot";a:0:{}s:14:"referenceField";N;s:9:"keyColumn";N;s:8:"_locator";N;s:10:"_resources";a:0:{}}}'
;
$coll
=
unserialize
(
$serializedFormCollection
);
$this
->
assertEquals
(
Doctrine_Collection
,
get_class
(
$coll
));
$this
->
assertEquals
(
'Doctrine_Collection'
,
get_class
(
$coll
));
}
/**
...
...
tests_old/models/CustomPK.php
View file @
e354e527
<?php
class
CustomPK
extends
Doctrine_Record
{
public
static
function
initMetadata
(
$class
)
{
$class
->
setColumn
(
'uid'
,
'integer'
,
11
,
'autoincrement|primary'
);
$class
->
setColumn
(
'uid'
,
'integer'
,
11
,
array
(
'autoincrement'
=>
true
,
'primary'
=>
true
)
);
$class
->
setColumn
(
'name'
,
'string'
,
255
);
}
}
tests_old/models/Email.php
View file @
e354e527
<?php
class
Email
extends
Doctrine_Record
class
Email
extends
Doctrine_Record
{
public
static
function
initMetadata
(
$class
)
public
static
function
initMetadata
(
$class
)
{
$class
->
setColumn
(
'address'
,
'string'
,
150
,
'email|unique'
);
$class
->
setColumn
(
'address'
,
'string'
,
150
,
array
(
'email'
,
'unique'
=>
true
)
);
}
...
...
tests_old/models/EntityReference.php
View file @
e354e527
...
...
@@ -3,8 +3,8 @@ class EntityReference extends Doctrine_Record
{
public
static
function
initMetadata
(
$class
)
{
$class
->
setColumn
(
'entity1'
,
'integer'
,
null
,
'primary'
);
$class
->
setColumn
(
'entity2'
,
'integer'
,
null
,
'primary'
);
$class
->
setColumn
(
'entity1'
,
'integer'
,
null
,
array
(
'primary'
=>
true
)
);
$class
->
setColumn
(
'entity2'
,
'integer'
,
null
,
array
(
'primary'
=>
true
)
);
}
}
tests_old/models/Error.php
View file @
e354e527
...
...
@@ -3,7 +3,7 @@ class Error extends Doctrine_Record {
public
static
function
initMetadata
(
$class
)
{
$class
->
setColumn
(
'message'
,
'string'
,
200
);
$class
->
setColumn
(
'code'
,
'integer'
,
11
);
$class
->
setColumn
(
'file_md5'
,
'string'
,
32
,
'primary'
);
$class
->
setColumn
(
'file_md5'
,
'string'
,
32
,
array
(
'primary'
=>
true
)
);
$class
->
hasMany
(
'Description'
,
array
(
'local'
=>
'file_md5'
,
'foreign'
=>
'file_md5'
));
}
}
...
...
tests_old/models/MysqlTestRecord.php
View file @
e354e527
...
...
@@ -3,8 +3,8 @@ class MysqlTestRecord extends Doctrine_Record
{
public
static
function
initMetadata
(
$class
)
{
$class
->
setColumn
(
'name'
,
'string'
,
null
,
'primary'
);
$class
->
setColumn
(
'code'
,
'integer'
,
null
,
'primary'
);
$class
->
setColumn
(
'name'
,
'string'
,
null
,
array
(
'primary'
=>
true
)
);
$class
->
setColumn
(
'code'
,
'integer'
,
null
,
array
(
'primary'
=>
true
)
);
$class
->
setTableOption
(
'type'
,
'INNODB'
);
}
...
...
tests_old/models/NestReference.php
View file @
e354e527
...
...
@@ -3,7 +3,7 @@ class NestReference extends Doctrine_Record
{
public
static
function
initMetadata
(
$class
)
{
$class
->
setColumn
(
'parent_id'
,
'integer'
,
4
,
'primary'
);
$class
->
setColumn
(
'child_id'
,
'integer'
,
4
,
'primary'
);
$class
->
setColumn
(
'parent_id'
,
'integer'
,
4
,
array
(
'primary'
=>
true
)
);
$class
->
setColumn
(
'child_id'
,
'integer'
,
4
,
array
(
'primary'
=>
true
)
);
}
}
tests_old/models/NotNullTest.php
View file @
e354e527
<?php
class
NotNullTest
extends
Doctrine_Record
{
public
static
function
initMetadata
(
$class
)
{
$class
->
setColumn
(
'name'
,
'string'
,
100
,
'notnull'
);
$class
->
setColumn
(
'type'
,
'integer'
,
11
);
$class
->
setColumn
(
'name'
,
'string'
,
100
,
array
(
'notnull'
=>
true
)
);
$class
->
setColumn
(
'type'
,
'integer'
,
11
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment