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
be5aac16
Commit
be5aac16
authored
Feb 16, 2008
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small refactorings
parent
b3de3fb9
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
35 deletions
+26
-35
ClassMetadata.php
lib/Doctrine/ClassMetadata.php
+3
-12
Factory.php
lib/Doctrine/ClassMetadata/Factory.php
+1
-1
CmsUser.php
tests/models/cms/CmsUser.php
+3
-3
ForumAdministrator.php
tests/models/forum/ForumAdministrator.php
+1
-1
ForumUser.php
tests/models/forum/ForumUser.php
+3
-3
FactoryTestCase.php
tests_old/Metadata/FactoryTestCase.php
+15
-15
No files found.
lib/Doctrine/ClassMetadata.php
View file @
be5aac16
...
...
@@ -479,14 +479,6 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
}
}
/**
* @deprecated
*/
public
function
mapField
(
$name
,
$type
,
$length
=
null
,
$options
=
array
(),
$prepend
=
false
)
{
return
$this
->
setColumn
(
$name
,
$type
,
$length
,
$options
,
$prepend
);
}
/**
* addMappedColumn
*
...
...
@@ -497,9 +489,8 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
* @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.
* @deprecated
*/
public
function
addMapped
Column
(
$name
,
$type
,
$length
=
null
,
$options
=
array
(),
$prepend
=
false
)
public
function
map
Column
(
$name
,
$type
,
$length
=
null
,
$options
=
array
(),
$prepend
=
false
)
{
if
(
is_string
(
$options
))
{
$options
=
explode
(
'|'
,
$options
);
...
...
@@ -598,11 +589,11 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
* By default the column gets appended.
* @throws Doctrine_Table_Exception if trying use wrongly typed parameter
* @return void
* @deprecated
* @deprecated
Use mapColumn()
*/
public
function
setColumn
(
$name
,
$type
,
$length
=
null
,
$options
=
array
(),
$prepend
=
false
)
{
return
$this
->
addMapped
Column
(
$name
,
$type
,
$length
,
$options
,
$prepend
);
return
$this
->
map
Column
(
$name
,
$type
,
$length
,
$options
,
$prepend
);
}
/**
...
...
lib/Doctrine/ClassMetadata/Factory.php
View file @
be5aac16
...
...
@@ -127,7 +127,7 @@ class Doctrine_ClassMetadata_Factory
foreach
(
$parentClass
->
getColumns
()
as
$name
=>
$definition
)
{
$fullName
=
"
$name
as "
.
$parentClass
->
getFieldName
(
$name
);
$definition
[
'inherited'
]
=
true
;
$subClass
->
addMapped
Column
(
$fullName
,
$definition
[
'type'
],
$definition
[
'length'
],
$subClass
->
map
Column
(
$fullName
,
$definition
[
'type'
],
$definition
[
'length'
],
$definition
);
}
}
...
...
tests/models/cms/CmsUser.php
View file @
be5aac16
...
...
@@ -3,8 +3,8 @@ class CmsUser extends Doctrine_Record
{
public
static
function
initMetadata
(
$class
)
{
$class
->
set
Column
(
'id'
,
'integer'
,
4
,
array
(
'primary'
=>
true
,
'autoincrement'
=>
true
));
$class
->
set
Column
(
'username'
,
'string'
,
255
);
$class
->
set
Column
(
'name'
,
'string'
,
255
);
$class
->
map
Column
(
'id'
,
'integer'
,
4
,
array
(
'primary'
=>
true
,
'autoincrement'
=>
true
));
$class
->
map
Column
(
'username'
,
'string'
,
255
);
$class
->
map
Column
(
'name'
,
'string'
,
255
);
}
}
tests/models/forum/ForumAdministrator.php
View file @
be5aac16
...
...
@@ -4,6 +4,6 @@ class ForumAdministrator extends ForumUser
{
public
static
function
initMetadata
(
$class
)
{
$class
->
addMapped
Column
(
'foo'
,
'string'
,
50
);
$class
->
map
Column
(
'foo'
,
'string'
,
50
);
}
}
\ No newline at end of file
tests/models/forum/ForumUser.php
View file @
be5aac16
...
...
@@ -14,13 +14,13 @@ class ForumUser extends Doctrine_Record
$class
->
setSubclasses
(
array
(
'ForumAdministrator'
));
// the discriminator column
$class
->
addMapped
Column
(
'dtype'
,
'string'
,
50
);
$class
->
map
Column
(
'dtype'
,
'string'
,
50
);
// property mapping
$class
->
addMapped
Column
(
'id'
,
'integer'
,
4
,
array
(
$class
->
map
Column
(
'id'
,
'integer'
,
4
,
array
(
'primary'
=>
true
,
'autoincrement'
=>
true
));
$class
->
addMapped
Column
(
'username'
,
'string'
,
50
);
$class
->
map
Column
(
'username'
,
'string'
,
50
);
}
}
\ No newline at end of file
tests_old/Metadata/FactoryTestCase.php
View file @
be5aac16
...
...
@@ -22,7 +22,7 @@ class Doctrine_Metadata_Factory_TestCase extends Doctrine_UnitTestCase
public
function
testMetadataSetupOnClassTableInheritanceHierarchy
()
{
$userClass
=
$this
->
conn
->
getMetadata
(
'Metadata_User'
);
$userClass
=
$this
->
conn
->
get
Class
Metadata
(
'Metadata_User'
);
$this
->
assertTrue
(
$userClass
instanceof
Doctrine_ClassMetadata
);
$this
->
assertEqual
(
'cti_user'
,
$userClass
->
getTableName
());
$this
->
assertEqual
(
4
,
count
(
$userClass
->
getFields
()));
...
...
@@ -156,10 +156,10 @@ class Metadata_User extends Doctrine_Record
)
);
$class
->
setSubclasses
(
array
(
'Metadata_Manager'
,
'Metadata_Customer'
,
'Metadata_SuperManager'
));
$class
->
map
Field
(
'cti_id as id'
,
'integer'
,
4
,
array
(
'primary'
=>
true
,
'autoincrement'
=>
true
));
$class
->
map
Field
(
'cti_foo as foo'
,
'integer'
,
4
);
$class
->
map
Field
(
'cti_name as name'
,
'string'
,
50
);
$class
->
map
Field
(
'type'
,
'integer'
,
1
);
$class
->
map
Column
(
'cti_id as id'
,
'integer'
,
4
,
array
(
'primary'
=>
true
,
'autoincrement'
=>
true
));
$class
->
map
Column
(
'cti_foo as foo'
,
'integer'
,
4
);
$class
->
map
Column
(
'cti_name as name'
,
'string'
,
50
);
$class
->
map
Column
(
'type'
,
'integer'
,
1
);
//$class->setNamedQuery('findByName', 'SELECT u.* FROM User u WHERE u.name = ?');
}
...
...
@@ -171,7 +171,7 @@ class Metadata_Manager extends Metadata_User
{
$class
->
setTableName
(
'cti_manager'
);
$class
->
setSubclasses
(
array
(
'Metadata_SuperManager'
));
$class
->
map
Field
(
'ctim_salary as salary'
,
'varchar'
,
50
,
array
());
$class
->
map
Column
(
'ctim_salary as salary'
,
'varchar'
,
50
,
array
());
}
}
...
...
@@ -180,7 +180,7 @@ class Metadata_Customer extends Metadata_User
public
static
function
initMetadata
(
Doctrine_ClassMetadata
$class
)
{
$class
->
setTableName
(
'cti_customer'
);
$class
->
set
Column
(
'ctic_bonuspoints as bonuspoints'
,
'varchar'
,
50
,
array
());
$class
->
map
Column
(
'ctic_bonuspoints as bonuspoints'
,
'varchar'
,
50
,
array
());
}
}
...
...
@@ -189,7 +189,7 @@ class Metadata_SuperManager extends Metadata_Manager
public
static
function
initMetadata
(
Doctrine_ClassMetadata
$class
)
{
$class
->
setTableName
(
'cti_supermanager'
);
$class
->
map
Field
(
'ctism_gosutitle as gosutitle'
,
'varchar'
,
50
,
array
());
$class
->
map
Column
(
'ctism_gosutitle as gosutitle'
,
'varchar'
,
50
,
array
());
}
}
...
...
@@ -210,10 +210,10 @@ class Metadata_STI_User extends Doctrine_Record
)
);
$class
->
setSubclasses
(
array
(
'Metadata_STI_Manager'
,
'Metadata_STI_Customer'
,
'Metadata_STI_SuperManager'
));
$class
->
map
Field
(
'cti_id as id'
,
'integer'
,
4
,
array
(
'primary'
=>
true
,
'autoincrement'
=>
true
));
$class
->
map
Field
(
'cti_foo as foo'
,
'integer'
,
4
);
$class
->
map
Field
(
'cti_name as name'
,
'string'
,
50
);
$class
->
map
Field
(
'type'
,
'integer'
,
1
);
$class
->
map
Column
(
'cti_id as id'
,
'integer'
,
4
,
array
(
'primary'
=>
true
,
'autoincrement'
=>
true
));
$class
->
map
Column
(
'cti_foo as foo'
,
'integer'
,
4
);
$class
->
map
Column
(
'cti_name as name'
,
'string'
,
50
);
$class
->
map
Column
(
'type'
,
'integer'
,
1
);
//$class->setNamedQuery('findByName', 'SELECT u.* FROM User u WHERE u.name = ?');
}
...
...
@@ -225,7 +225,7 @@ class Metadata_STI_Manager extends Metadata_STI_User
{
$class
->
setTableName
(
'cti_manager'
);
$class
->
setSubclasses
(
array
(
'Metadata_STI_SuperManager'
));
$class
->
map
Field
(
'ctim_salary as salary'
,
'varchar'
,
50
,
array
());
$class
->
map
Column
(
'ctim_salary as salary'
,
'varchar'
,
50
,
array
());
}
}
...
...
@@ -234,7 +234,7 @@ class Metadata_STI_Customer extends Metadata_STI_User
public
static
function
initMetadata
(
$class
)
{
$class
->
setTableName
(
'cti_customer'
);
$class
->
set
Column
(
'ctic_bonuspoints as bonuspoints'
,
'varchar'
,
50
,
array
());
$class
->
map
Column
(
'ctic_bonuspoints as bonuspoints'
,
'varchar'
,
50
,
array
());
}
}
...
...
@@ -243,7 +243,7 @@ class Metadata_STI_SuperManager extends Metadata_STI_Manager
public
static
function
initMetadata
(
$class
)
{
$class
->
setTableName
(
'cti_supermanager'
);
$class
->
map
Field
(
'ctism_gosutitle as gosutitle'
,
'varchar'
,
50
,
array
());
$class
->
map
Column
(
'ctism_gosutitle as gosutitle'
,
'varchar'
,
50
,
array
());
}
}
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