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
fc310cf3
Commit
fc310cf3
authored
Dec 01, 2007
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed #626. Commented out plugin tests due to a fatal error.
parent
a73a73da
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
212 additions
and
21 deletions
+212
-21
Collection.php
lib/Doctrine/Collection.php
+7
-7
Record.php
lib/Doctrine/Record.php
+2
-2
Relation.php
lib/Doctrine/Relation.php
+21
-0
Self.php
lib/Doctrine/Relation/Association/Self.php
+6
-3
ForeignKey.php
lib/Doctrine/Relation/ForeignKey.php
+4
-3
LocalKey.php
lib/Doctrine/Relation/LocalKey.php
+3
-2
Nest.php
lib/Doctrine/Relation/Nest.php
+6
-3
Parser.php
lib/Doctrine/Relation/Parser.php
+2
-0
626BTestCase.php
tests/Ticket/626BTestCase.php
+159
-0
run.php
tests/run.php
+2
-1
No files found.
lib/Doctrine/Collection.php
View file @
fc310cf3
...
@@ -262,15 +262,15 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
...
@@ -262,15 +262,15 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
*/
*/
public
function
setReference
(
Doctrine_Record
$record
,
Doctrine_Relation
$relation
)
public
function
setReference
(
Doctrine_Record
$record
,
Doctrine_Relation
$relation
)
{
{
$this
->
reference
=
$record
;
$this
->
reference
=
$record
;
$this
->
relation
=
$relation
;
$this
->
relation
=
$relation
;
if
(
$relation
instanceof
Doctrine_Relation_ForeignKey
||
if
(
$relation
instanceof
Doctrine_Relation_ForeignKey
||
$relation
instanceof
Doctrine_Relation_LocalKey
)
{
$relation
instanceof
Doctrine_Relation_LocalKey
)
{
$this
->
referenceField
=
$relation
->
getForeign
();
$this
->
referenceField
=
$relation
->
getForeign
FieldName
();
$value
=
$record
->
get
(
$relation
->
getLocal
());
$value
=
$record
->
get
(
$relation
->
getLocal
FieldName
());
foreach
(
$this
->
data
as
$record
)
{
foreach
(
$this
->
data
as
$record
)
{
if
(
$value
!==
null
)
{
if
(
$value
!==
null
)
{
...
@@ -348,7 +348,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
...
@@ -348,7 +348,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
$record
=
$this
->
_table
->
create
();
$record
=
$this
->
_table
->
create
();
if
(
isset
(
$this
->
referenceField
))
{
if
(
isset
(
$this
->
referenceField
))
{
$value
=
$this
->
reference
->
get
(
$this
->
relation
->
getLocal
());
$value
=
$this
->
reference
->
get
(
$this
->
relation
->
getLocal
FieldName
());
if
(
$value
!==
null
)
{
if
(
$value
!==
null
)
{
$record
->
set
(
$this
->
referenceField
,
$value
,
false
);
$record
->
set
(
$this
->
referenceField
,
$value
,
false
);
...
@@ -436,7 +436,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
...
@@ -436,7 +436,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
public
function
add
(
Doctrine_Record
$record
,
$key
=
null
)
public
function
add
(
Doctrine_Record
$record
,
$key
=
null
)
{
{
if
(
isset
(
$this
->
referenceField
))
{
if
(
isset
(
$this
->
referenceField
))
{
$value
=
$this
->
reference
->
get
(
$this
->
relation
->
getLocal
());
$value
=
$this
->
reference
->
get
(
$this
->
relation
->
getLocal
FieldName
());
if
(
$value
!==
null
)
{
if
(
$value
!==
null
)
{
$record
->
set
(
$this
->
referenceField
,
$value
,
false
);
$record
->
set
(
$this
->
referenceField
,
$value
,
false
);
...
...
lib/Doctrine/Record.php
View file @
fc310cf3
...
@@ -821,9 +821,9 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
...
@@ -821,9 +821,9 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
try
{
try
{
if
(
!
isset
(
$this
->
_references
[
$fieldName
])
&&
$load
)
{
if
(
!
isset
(
$this
->
_references
[
$fieldName
])
&&
$load
)
{
$rel
=
$this
->
_table
->
getRelation
(
$fieldName
);
$rel
=
$this
->
_table
->
getRelation
(
$fieldName
);
$this
->
_references
[
$fieldName
]
=
$rel
->
fetchRelatedFor
(
$this
);
$this
->
_references
[
$fieldName
]
=
$rel
->
fetchRelatedFor
(
$this
);
}
}
return
$this
->
_references
[
$fieldName
];
return
$this
->
_references
[
$fieldName
];
...
...
lib/Doctrine/Relation.php
View file @
fc310cf3
...
@@ -66,6 +66,7 @@ abstract class Doctrine_Relation implements ArrayAccess
...
@@ -66,6 +66,7 @@ abstract class Doctrine_Relation implements ArrayAccess
'class'
=>
true
,
'class'
=>
true
,
'type'
=>
true
,
'type'
=>
true
,
'table'
=>
true
,
'table'
=>
true
,
'localTable'
=>
true
,
'name'
=>
false
,
'name'
=>
false
,
'refTable'
=>
false
,
'refTable'
=>
false
,
'onDelete'
=>
false
,
'onDelete'
=>
false
,
...
@@ -88,6 +89,8 @@ abstract class Doctrine_Relation implements ArrayAccess
...
@@ -88,6 +89,8 @@ abstract class Doctrine_Relation implements ArrayAccess
*
*
* table the foreign table object
* table the foreign table object
*
*
* localTable the local table object
*
* refTable the reference table object (if any)
* refTable the reference table object (if any)
*
*
* onDelete referential delete action
* onDelete referential delete action
...
@@ -246,6 +249,15 @@ abstract class Doctrine_Relation implements ArrayAccess
...
@@ -246,6 +249,15 @@ abstract class Doctrine_Relation implements ArrayAccess
{
{
return
$this
->
definition
[
'local'
];
return
$this
->
definition
[
'local'
];
}
}
/**
* getLocalFieldName
* returns the field name of the local column
*/
final
public
function
getLocalFieldName
()
{
return
$this
->
definition
[
'localTable'
]
->
getFieldName
(
$this
->
definition
[
'local'
]);
}
/**
/**
* getForeign
* getForeign
...
@@ -258,6 +270,15 @@ abstract class Doctrine_Relation implements ArrayAccess
...
@@ -258,6 +270,15 @@ abstract class Doctrine_Relation implements ArrayAccess
{
{
return
$this
->
definition
[
'foreign'
];
return
$this
->
definition
[
'foreign'
];
}
}
/**
* getLocalFieldName
* returns the field name of the local column
*/
final
public
function
getForeignFieldName
()
{
return
$this
->
definition
[
'table'
]
->
getFieldName
(
$this
->
definition
[
'foreign'
]);
}
/**
/**
* isComposite
* isComposite
...
...
lib/Doctrine/Relation/Association/Self.php
View file @
fc310cf3
...
@@ -42,6 +42,8 @@ class Doctrine_Relation_Association_Self extends Doctrine_Relation_Association
...
@@ -42,6 +42,8 @@ class Doctrine_Relation_Association_Self extends Doctrine_Relation_Association
{
{
switch
(
$context
)
{
switch
(
$context
)
{
case
'record'
:
case
'record'
:
$identifierColumnNames
=
$this
->
definition
[
'table'
]
->
getIdentifierColumnNames
();
$identifier
=
array_pop
(
$identifierColumnNames
);
$sub
=
'SELECT '
.
$this
->
definition
[
'foreign'
]
$sub
=
'SELECT '
.
$this
->
definition
[
'foreign'
]
.
' FROM '
.
$this
->
definition
[
'refTable'
]
->
getTableName
()
.
' FROM '
.
$this
->
definition
[
'refTable'
]
->
getTableName
()
.
' WHERE '
.
$this
->
definition
[
'local'
]
.
' WHERE '
.
$this
->
definition
[
'local'
]
...
@@ -55,10 +57,10 @@ class Doctrine_Relation_Association_Self extends Doctrine_Relation_Association
...
@@ -55,10 +57,10 @@ class Doctrine_Relation_Association_Self extends Doctrine_Relation_Association
$dql
=
'FROM '
.
$this
->
definition
[
'table'
]
->
getComponentName
()
$dql
=
'FROM '
.
$this
->
definition
[
'table'
]
->
getComponentName
()
.
'.'
.
$this
->
definition
[
'refTable'
]
->
getComponentName
()
.
'.'
.
$this
->
definition
[
'refTable'
]
->
getComponentName
()
.
' WHERE '
.
$this
->
definition
[
'table'
]
->
getComponentName
()
.
' WHERE '
.
$this
->
definition
[
'table'
]
->
getComponentName
()
.
'.'
.
$
this
->
definition
[
'table'
]
->
getIdentifier
()
.
'.'
.
$
identifier
.
' IN ('
.
$sub
.
')'
.
' IN ('
.
$sub
.
')'
.
' || '
.
$this
->
definition
[
'table'
]
->
getComponentName
()
.
' || '
.
$this
->
definition
[
'table'
]
->
getComponentName
()
.
'.'
.
$
this
->
definition
[
'table'
]
->
getIdentifier
()
.
'.'
.
$
identifier
.
' IN ('
.
$sub2
.
')'
;
.
' IN ('
.
$sub2
.
')'
;
break
;
break
;
case
'collection'
:
case
'collection'
:
...
@@ -80,7 +82,8 @@ class Doctrine_Relation_Association_Self extends Doctrine_Relation_Association
...
@@ -80,7 +82,8 @@ class Doctrine_Relation_Association_Self extends Doctrine_Relation_Association
$assocTable
=
$this
->
getAssociationFactory
()
->
getTableName
();
$assocTable
=
$this
->
getAssociationFactory
()
->
getTableName
();
$tableName
=
$record
->
getTable
()
->
getTableName
();
$tableName
=
$record
->
getTable
()
->
getTableName
();
$identifier
=
$record
->
getTable
()
->
getIdentifier
();
$identifierColumnNames
=
$record
->
getTable
()
->
getIdentifierColumnNames
();
$identifier
=
array_pop
(
$identifierColumnNames
);
$sub
=
'SELECT '
.
$this
->
getForeign
()
.
$sub
=
'SELECT '
.
$this
->
getForeign
()
.
' FROM '
.
$assocTable
.
' FROM '
.
$assocTable
.
...
...
lib/Doctrine/Relation/ForeignKey.php
View file @
fc310cf3
...
@@ -44,8 +44,9 @@ class Doctrine_Relation_ForeignKey extends Doctrine_Relation
...
@@ -44,8 +44,9 @@ class Doctrine_Relation_ForeignKey extends Doctrine_Relation
public
function
fetchRelatedFor
(
Doctrine_Record
$record
)
public
function
fetchRelatedFor
(
Doctrine_Record
$record
)
{
{
$id
=
array
();
$id
=
array
();
$localTable
=
$record
->
getTable
();
foreach
((
array
)
$this
->
definition
[
'local'
]
as
$local
)
{
foreach
((
array
)
$this
->
definition
[
'local'
]
as
$local
)
{
$value
=
$record
->
get
(
$local
);
$value
=
$record
->
get
(
$local
Table
->
getFieldName
(
$local
)
);
if
(
isset
(
$value
))
{
if
(
isset
(
$value
))
{
$id
[]
=
$value
;
$id
[]
=
$value
;
}
}
...
@@ -63,8 +64,8 @@ class Doctrine_Relation_ForeignKey extends Doctrine_Relation
...
@@ -63,8 +64,8 @@ class Doctrine_Relation_ForeignKey extends Doctrine_Relation
$related
=
$coll
[
0
];
$related
=
$coll
[
0
];
}
}
$related
->
set
(
$
this
->
definition
[
'foreign'
],
$record
,
false
);
$related
->
set
(
$
related
->
getTable
()
->
getFieldName
(
$this
->
definition
[
'foreign'
]),
$record
,
false
);
}
else
{
}
else
{
if
(
!
$record
->
exists
()
||
empty
(
$id
)
||
if
(
!
$record
->
exists
()
||
empty
(
$id
)
||
...
...
lib/Doctrine/Relation/LocalKey.php
View file @
fc310cf3
...
@@ -43,7 +43,8 @@ class Doctrine_Relation_LocalKey extends Doctrine_Relation
...
@@ -43,7 +43,8 @@ class Doctrine_Relation_LocalKey extends Doctrine_Relation
*/
*/
public
function
fetchRelatedFor
(
Doctrine_Record
$record
)
public
function
fetchRelatedFor
(
Doctrine_Record
$record
)
{
{
$id
=
$record
->
get
(
$this
->
definition
[
'local'
]);
$localFieldName
=
$record
->
getTable
()
->
getFieldName
(
$this
->
definition
[
'local'
]);
$id
=
$record
->
get
(
$localFieldName
);
if
(
empty
(
$id
)
||
!
$this
->
definition
[
'table'
]
->
getAttribute
(
Doctrine
::
ATTR_LOAD_REFERENCES
))
{
if
(
empty
(
$id
)
||
!
$this
->
definition
[
'table'
]
->
getAttribute
(
Doctrine
::
ATTR_LOAD_REFERENCES
))
{
$related
=
$this
->
getTable
()
->
create
();
$related
=
$this
->
getTable
()
->
create
();
...
@@ -61,7 +62,7 @@ class Doctrine_Relation_LocalKey extends Doctrine_Relation
...
@@ -61,7 +62,7 @@ class Doctrine_Relation_LocalKey extends Doctrine_Relation
}
}
}
}
$record
->
set
(
$
this
->
definition
[
'local'
]
,
$related
,
false
);
$record
->
set
(
$
localFieldName
,
$related
,
false
);
return
$related
;
return
$related
;
}
}
...
...
lib/Doctrine/Relation/Nest.php
View file @
fc310cf3
...
@@ -42,6 +42,8 @@ class Doctrine_Relation_Nest extends Doctrine_Relation_Association
...
@@ -42,6 +42,8 @@ class Doctrine_Relation_Nest extends Doctrine_Relation_Association
{
{
switch
(
$context
)
{
switch
(
$context
)
{
case
'record'
:
case
'record'
:
$identifierColumnNames
=
$this
->
definition
[
'table'
]
->
getIdentifierColumnNames
();
$identifier
=
array_pop
(
$identifierColumnNames
);
$sub
=
'SELECT '
.
$this
->
definition
[
'foreign'
]
$sub
=
'SELECT '
.
$this
->
definition
[
'foreign'
]
.
' FROM '
.
$this
->
definition
[
'refTable'
]
->
getTableName
()
.
' FROM '
.
$this
->
definition
[
'refTable'
]
->
getTableName
()
.
' WHERE '
.
$this
->
definition
[
'local'
]
.
' WHERE '
.
$this
->
definition
[
'local'
]
...
@@ -55,10 +57,10 @@ class Doctrine_Relation_Nest extends Doctrine_Relation_Association
...
@@ -55,10 +57,10 @@ class Doctrine_Relation_Nest extends Doctrine_Relation_Association
$dql
=
'FROM '
.
$this
->
definition
[
'table'
]
->
getComponentName
()
$dql
=
'FROM '
.
$this
->
definition
[
'table'
]
->
getComponentName
()
.
'.'
.
$this
->
definition
[
'refTable'
]
->
getComponentName
()
.
'.'
.
$this
->
definition
[
'refTable'
]
->
getComponentName
()
.
' WHERE '
.
$this
->
definition
[
'table'
]
->
getComponentName
()
.
' WHERE '
.
$this
->
definition
[
'table'
]
->
getComponentName
()
.
'.'
.
$
this
->
definition
[
'table'
]
->
getIdentifier
()
.
'.'
.
$
identifier
.
' IN ('
.
$sub
.
')'
.
' IN ('
.
$sub
.
')'
.
' || '
.
$this
->
definition
[
'table'
]
->
getComponentName
()
.
' || '
.
$this
->
definition
[
'table'
]
->
getComponentName
()
.
'.'
.
$
this
->
definition
[
'table'
]
->
getIdentifier
()
.
'.'
.
$
identifier
.
' IN ('
.
$sub2
.
')'
;
.
' IN ('
.
$sub2
.
')'
;
break
;
break
;
case
'collection'
:
case
'collection'
:
...
@@ -110,7 +112,8 @@ class Doctrine_Relation_Nest extends Doctrine_Relation_Association
...
@@ -110,7 +112,8 @@ class Doctrine_Relation_Nest extends Doctrine_Relation_Association
$assocTable
=
$this
->
getAssociationFactory
()
->
getTableName
();
$assocTable
=
$this
->
getAssociationFactory
()
->
getTableName
();
$tableName
=
$record
->
getTable
()
->
getTableName
();
$tableName
=
$record
->
getTable
()
->
getTableName
();
$identifier
=
$record
->
getTable
()
->
getIdentifier
();
$identifierColumnNames
=
$record
->
getTable
()
->
getIdentifierColumnNames
();
$identifier
=
array_pop
(
$identifierColumnNames
);
$sub
=
'SELECT '
.
$this
->
getForeign
()
$sub
=
'SELECT '
.
$this
->
getForeign
()
.
' FROM '
.
$assocTable
.
' FROM '
.
$assocTable
...
...
lib/Doctrine/Relation/Parser.php
View file @
fc310cf3
...
@@ -257,6 +257,7 @@ class Doctrine_Relation_Parser
...
@@ -257,6 +257,7 @@ class Doctrine_Relation_Parser
{
{
$conn
=
$this
->
_table
->
getConnection
();
$conn
=
$this
->
_table
->
getConnection
();
$def
[
'table'
]
=
$this
->
getImpl
(
$def
[
'class'
]);
$def
[
'table'
]
=
$this
->
getImpl
(
$def
[
'class'
]);
$def
[
'localTable'
]
=
$this
->
_table
;
$def
[
'class'
]
=
$def
[
'table'
]
->
getComponentName
();
$def
[
'class'
]
=
$def
[
'table'
]
->
getComponentName
();
$def
[
'refTable'
]
=
$this
->
getImpl
(
$def
[
'refClass'
]);
$def
[
'refTable'
]
=
$this
->
getImpl
(
$def
[
'refClass'
]);
...
@@ -371,6 +372,7 @@ class Doctrine_Relation_Parser
...
@@ -371,6 +372,7 @@ class Doctrine_Relation_Parser
{
{
$conn
=
$this
->
_table
->
getConnection
();
$conn
=
$this
->
_table
->
getConnection
();
$def
[
'table'
]
=
$this
->
getImpl
(
$def
[
'class'
]);
$def
[
'table'
]
=
$this
->
getImpl
(
$def
[
'class'
]);
$def
[
'localTable'
]
=
$this
->
_table
;
$def
[
'class'
]
=
$def
[
'table'
]
->
getComponentName
();
$def
[
'class'
]
=
$def
[
'table'
]
->
getComponentName
();
$foreignClasses
=
array_merge
(
$def
[
'table'
]
->
getOption
(
'parents'
),
array
(
$def
[
'class'
]));
$foreignClasses
=
array_merge
(
$def
[
'table'
]
->
getOption
(
'parents'
),
array
(
$def
[
'class'
]));
...
...
tests/Ticket/626BTestCase.php
0 → 100644
View file @
fc310cf3
<?php
/**
* Doctrine_Ticket_626_TestCase
*
* @package Doctrine
* @author Tamcy <7am.online@gmail.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision$
*/
class
Doctrine_Ticket_626B_TestCase
extends
Doctrine_UnitTestCase
{
public
function
prepareData
()
{
}
public
function
prepareTables
()
{
$this
->
tables
=
array
(
'T626_Group'
,
'T626B_Student'
,
'T626_Course'
,
'T626B_StudentCourse'
);
parent
::
prepareTables
();
}
protected
function
newCourse
(
$id
,
$name
)
{
$course
=
new
T626_Course
();
$course
->
id
=
$id
;
$course
->
name
=
$name
;
$course
->
save
();
return
$course
;
}
protected
function
newGroup
(
$id
,
$name
)
{
$group
=
new
T626_Group
();
$group
->
id
=
$id
;
$group
->
name
=
$name
;
$group
->
save
();
return
$group
;
}
protected
function
newStudent
(
$id
,
$name
,
$group
)
{
$u
=
new
T626B_Student
();
$u
->
id
=
$id
;
$u
->
name
=
$name
;
$u
->
group_id
=
$group
->
id
;
$u
->
save
();
return
$u
;
}
protected
function
newStudentCourse
(
$student
,
$course
)
{
$sc
=
new
T626B_StudentCourse
;
$sc
->
student_id
=
$student
->
id
;
$sc
->
course_id
=
$course
->
id
;
$sc
->
save
();
return
$sc
;
}
public
function
testTicket
()
{
$group1
=
$this
->
newGroup
(
'1'
,
'Group 1'
);
$student1
=
$this
->
newStudent
(
'07090002'
,
'First Student'
,
$group1
);
$course1
=
$this
->
newCourse
(
'MATH001'
,
'Maths'
);
$course2
=
$this
->
newCourse
(
'ENG002'
,
'English Literature'
);
$this
->
newStudentCourse
(
$student1
,
$course1
);
$this
->
newStudentCourse
(
$student1
,
$course2
);
try
{
$group
=
$student1
->
get
(
'Group'
);
$this
->
pass
();
}
catch
(
Exception
$e
)
{
$this
->
fail
(
$e
->
__toString
());
}
try
{
$courses
=
$student1
->
get
(
'StudyCourses'
);
$this
->
pass
();
}
catch
(
Exception
$e
)
{
$this
->
fail
(
$e
->
__toString
());
}
}
}
class
T626B_Student
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
setTableName
(
'T626B_Student_record'
);
$this
->
hasColumn
(
's_id as id'
,
'varchar'
,
30
,
array
(
'primary'
=>
true
,));
$this
->
hasColumn
(
's_g_id as group_id'
,
'varchar'
,
30
,
array
(
'notnull'
=>
true
));
$this
->
hasColumn
(
's_name as name'
,
'varchar'
,
50
,
array
());
}
public
function
setUp
()
{
$this
->
hasMany
(
'T626_Course as StudyCourses'
,
array
(
'refClass'
=>
'T626B_StudentCourse'
,
'local'
=>
'sc_student_id'
,
'foreign'
=>
'sc_course_id'
));
$this
->
hasOne
(
'T626_Group as Group'
,
array
(
'local'
=>
's_g_id'
,
'foreign'
=>
'g_id'
));
}
}
class
T626_Group
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
setTableName
(
'T626B_Student_group'
);
$this
->
hasColumn
(
'g_id as id'
,
'varchar'
,
30
,
array
(
'primary'
=>
true
,));
$this
->
hasColumn
(
'g_name as name'
,
'varchar'
,
50
,
array
());
}
public
function
setUp
()
{
$this
->
hasMany
(
'T626B_Student as Students'
,
array
(
'local'
=>
'g_id'
,
'foreign'
=>
's_id'
));
}
}
class
T626_Course
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
setTableName
(
'T626_course'
);
$this
->
hasColumn
(
'c_id as id'
,
'varchar'
,
20
,
array
(
'primary'
=>
true
,));
$this
->
hasColumn
(
'c_name as name'
,
'varchar'
,
50
,
array
());
}
public
function
setUp
()
{
$this
->
hasMany
(
'T626B_Student as Students'
,
array
(
'refClass'
=>
'T626B_StudentCourse'
,
'local'
=>
'sc_course_id'
,
'foreign'
=>
'sc_student_id'
));
}
}
class
T626B_StudentCourse
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
setTableName
(
'T626B_Student_course'
);
$this
->
hasColumn
(
'sc_student_id as student_id'
,
'varchar'
,
30
,
array
(
'primary'
=>
true
,));
$this
->
hasColumn
(
'sc_course_id as course_id'
,
'varchar'
,
20
,
array
(
'primary'
=>
true
,));
$this
->
hasColumn
(
'sc_remark as remark'
,
'varchar'
,
500
,
array
());
}
public
function
setUp
()
{
$this
->
hasOne
(
'T626B_Student as Student'
,
array
(
'local'
=>
'sc_student_id'
,
'foreign'
=>
's_id'
));
$this
->
hasOne
(
'T626_Course as Course'
,
array
(
'local'
=>
'sc_course_id'
,
'foreign'
=>
'c_id'
));
}
}
tests/run.php
View file @
fc310cf3
...
@@ -17,6 +17,7 @@ $tickets->addTestCase(new Doctrine_Ticket_480_TestCase());
...
@@ -17,6 +17,7 @@ $tickets->addTestCase(new Doctrine_Ticket_480_TestCase());
$tickets
->
addTestCase
(
new
Doctrine_Ticket_587_TestCase
());
$tickets
->
addTestCase
(
new
Doctrine_Ticket_587_TestCase
());
$tickets
->
addTestCase
(
new
Doctrine_Ticket_576_TestCase
());
$tickets
->
addTestCase
(
new
Doctrine_Ticket_576_TestCase
());
$tickets
->
addTestCase
(
new
Doctrine_Ticket_583_TestCase
());
$tickets
->
addTestCase
(
new
Doctrine_Ticket_583_TestCase
());
$tickets
->
addTestCase
(
new
Doctrine_Ticket_626B_TestCase
());
//If you write a ticket testcase add it here like shown above!
//If you write a ticket testcase add it here like shown above!
$test
->
addTestCase
(
$tickets
);
$test
->
addTestCase
(
$tickets
);
...
@@ -147,7 +148,7 @@ $test->addTestCase($data_types);
...
@@ -147,7 +148,7 @@ $test->addTestCase($data_types);
// Utility components
// Utility components
$plugins
=
new
GroupTest
(
'Plugin tests: View, Validator, Hook'
,
'plugins'
);
$plugins
=
new
GroupTest
(
'Plugin tests: View, Validator, Hook'
,
'plugins'
);
//$utility->addTestCase(new Doctrine_PessimisticLocking_TestCase());
//$utility->addTestCase(new Doctrine_PessimisticLocking_TestCase());
$plugins
->
addTestCase
(
new
Doctrine_Plugin_TestCase
());
//
$plugins->addTestCase(new Doctrine_Plugin_TestCase());
$plugins
->
addTestCase
(
new
Doctrine_View_TestCase
());
$plugins
->
addTestCase
(
new
Doctrine_View_TestCase
());
$plugins
->
addTestCase
(
new
Doctrine_AuditLog_TestCase
());
$plugins
->
addTestCase
(
new
Doctrine_AuditLog_TestCase
());
$plugins
->
addTestCase
(
new
Doctrine_Validator_TestCase
());
$plugins
->
addTestCase
(
new
Doctrine_Validator_TestCase
());
...
...
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