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
54e5f45c
Commit
54e5f45c
authored
Jul 09, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
591cbe40
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
14 deletions
+30
-14
Sqlite.php
lib/Doctrine/Export/Sqlite.php
+4
-5
OneToManyTestCase.php
tests/Relation/OneToManyTestCase.php
+26
-9
No files found.
lib/Doctrine/Export/Sqlite.php
View file @
54e5f45c
...
...
@@ -179,15 +179,14 @@ class Doctrine_Export_Sqlite extends Doctrine_Export
$queryFields
.=
', PRIMARY KEY('
.
implode
(
', '
,
array_values
(
$options
[
'primary'
]))
.
')'
;
}
$name
=
$this
->
conn
->
quoteIdentifier
(
$name
,
true
);
$query
[]
=
'CREATE TABLE '
.
$name
.
' ('
.
$queryFields
.
')'
;
if
(
isset
(
$options
[
'indexes'
])
&&
!
empty
(
$options
[
'indexes'
]))
{
foreach
(
$options
[
'indexes'
]
as
$index
=>
$definition
)
{
$query
Fields
.=
', '
.
$this
->
getIndexDeclaration
(
$index
,
$definition
);
$query
[]
=
$this
->
createIndexSql
(
$name
,
$index
,
$definition
);
}
}
$name
=
$this
->
conn
->
quoteIdentifier
(
$name
,
true
);
$query
=
'CREATE TABLE '
.
$name
.
' ('
.
$queryFields
.
')'
;
return
$query
;
...
...
tests/Relation/OneToManyTestCase.php
View file @
54e5f45c
...
...
@@ -34,7 +34,12 @@ class Doctrine_Relation_OneToMany_TestCase extends Doctrine_UnitTestCase
{
public
function
prepareData
()
{
}
public
function
prepareTables
()
{
$this
->
tables
=
array
(
'Entity'
,
'Phonenumber'
,
'Email'
,
'Policy'
,
'PolicyAsset'
);
parent
::
prepareTables
();
}
public
function
testRelationParsing
()
{
$table
=
$this
->
conn
->
getTable
(
'Entity'
);
...
...
@@ -47,7 +52,7 @@ class Doctrine_Relation_OneToMany_TestCase extends Doctrine_UnitTestCase
$this
->
assertTrue
(
$rel
instanceof
Doctrine_Relation_LocalKey
);
}
public
function
testRelationParsing2
()
{
$table
=
$this
->
conn
->
getTable
(
'Phonenumber'
);
...
...
@@ -66,6 +71,19 @@ class Doctrine_Relation_OneToMany_TestCase extends Doctrine_UnitTestCase
$this
->
assertTrue
(
$rel
instanceof
Doctrine_Relation_ForeignKey
);
}
public
function
testRelationSaving
()
{
$p
=
new
Policy
();
$p
->
policy_number
=
'123'
;
$a
=
new
PolicyAsset
();
$a
->
value
=
'123.13'
;
$p
->
PolicyAssets
[]
=
$a
;
$p
->
save
();
$this
->
assertEqual
(
$a
->
policy_number
,
'123'
);
}
public
function
testRelationSaving2
()
{
$e
=
new
Entity
();
$e
->
name
=
'test'
;
...
...
@@ -79,8 +97,8 @@ class Doctrine_Relation_OneToMany_TestCase extends Doctrine_UnitTestCase
}
class
Policy
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
setTableName
(
'policies'
);
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
'policy_number'
,
'integer'
,
11
,
array
(
'unique'
=>
true
));
}
...
...
@@ -88,22 +106,21 @@ class Policy extends Doctrine_Record
{
$this
->
hasMany
(
'PolicyAsset as PolicyAssets'
,
array
(
'local'
=>
'policy_number'
,
'foreign'
=>
'policy_number'
));
$this
->
index
(
'policy_number_index'
,
array
(
'fields'
=>
'policy_number'
));
$this
->
index
(
'policy_number_index'
,
array
(
'fields'
=>
array
(
'policy_number'
)
));
}
}
class
PolicyAsset
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
setTableName
(
'policy_assets'
);
$this
->
hasColumn
(
'policy_number'
,
'integer'
,
11
);
$this
->
hasColumn
(
'value'
,
'float'
,
10
,
array
(
'notblank'
=>
true
,));
}
public
function
setUp
(){
public
function
setUp
()
{
$this
->
hasOne
(
'Policy'
,
array
(
'foreign'
=>
'policy_number'
,
'local'
=>
'policy_number'
));
$this
->
index
(
'policy_number_index'
,
array
(
'fields'
=>
'policy_number'
));
$this
->
index
(
'vehicle_code_index'
,
array
(
'fields'
=>
'vehicle_code'
));
$this
->
index
(
'policy_number_index'
,
array
(
'fields'
=>
array
(
'policy_number'
)));
}
}
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