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
45bca035
Commit
45bca035
authored
Aug 21, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Docs updated
parent
f44cc732
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
50 additions
and
10 deletions
+50
-10
Validator.php
Doctrine/Validator.php
+3
-1
Date.php
Doctrine/Validator/Date.php
+8
-1
Mapping object relations - Inheritance - Column aggregation.php
...g object relations - Inheritance - Column aggregation.php
+6
-2
Mapping object relations - Join table associations - Many-to-Many.php
...ct relations - Join table associations - Many-to-Many.php
+5
-0
Mapping object relations - Join table associations - Many-to-Many.php
...ct relations - Join table associations - Many-to-Many.php
+9
-0
documentation.php
manual/documentation.php
+19
-6
No files found.
Doctrine/Validator.php
View file @
45bca035
...
...
@@ -226,7 +226,9 @@ class Doctrine_Validator {
$looseType
=
self
::
gettype
(
$var
);
if
(
$type
==
'enum'
)
$type
=
'integer'
;
$type
=
'integer'
;
elseif
(
$type
==
'date'
||
$type
==
'clob'
)
$type
=
'string'
;
switch
(
$looseType
)
:
case
'float'
:
...
...
Doctrine/Validator/Date.php
View file @
45bca035
...
...
@@ -8,7 +8,14 @@ class Doctrine_Validator_Date {
* @return boolean
*/
public
function
validate
(
Doctrine_Record
$record
,
$key
,
$value
,
$args
)
{
return
checkdate
(
$value
);
if
(
empty
(
$value
))
return
true
;
$e
=
explode
(
"-"
,
$value
);
if
(
count
(
$e
)
!==
3
)
return
false
;
return
checkdate
(
$e
[
1
],
$e
[
0
],
$e
[
2
]);
}
}
?>
manual/codes/Mapping object relations - Inheritance - Column aggregation.php
View file @
45bca035
...
...
@@ -5,18 +5,22 @@ class Entity extends Doctrine_Record {
$this
->
hasColumn
(
"username"
,
"string"
,
20
);
$this
->
hasColumn
(
"password"
,
"string"
,
16
);
$this
->
hasColumn
(
"created"
,
"integer"
,
11
);
// this column is used for column
// aggregation inheritance
$this
->
hasColumn
(
"type"
,
"integer"
,
11
);
}
}
class
User
extends
Entity
{
public
function
setUp
()
{
$this
->
setInheritanceMap
(
array
(
"type"
=>
1
);
$this
->
setInheritanceMap
(
array
(
"type"
=>
1
)
)
;
}
}
class
Group
extends
Entity
{
public
function
setUp
()
{
$this
->
setInheritanceMap
(
array
(
"type"
=>
2
);
$this
->
setInheritanceMap
(
array
(
"type"
=>
2
)
)
;
}
}
?>
manual/codes/Mapping object relations - Join table associations - Many-to-Many.php
View file @
45bca035
...
...
@@ -35,6 +35,10 @@ $user->Group[1]->name = "Second Group";
// save changes into database
$user
->
save
();
// deleting the associations between user and groups it belongs to
$user
->
Groupuser
->
delete
();
$groups
=
new
Doctrine_Collection
(
$session
->
getTable
(
"Group"
));
$groups
[
0
]
->
name
=
"Third Group"
;
...
...
@@ -46,4 +50,5 @@ $user->Group[2] = $groups[0];
$user
->
Group
=
$groups
;
// $user will now have two groups 'Third Group' and 'Fourth Group'
?>
manual/docs/Mapping object relations - Join table associations - Many-to-Many.php
View file @
45bca035
If
you
are
coming
from
relational
database
background
it
may
be
familiar
to
you
how
many
-
to
-
many
associations
are
handled
:
an
additional
association
table
is
needed
.
<
br
\
><
br
\
>
In
many
-
to
-
many
relations
the
relation
between
the
two
components
is
always
an
aggregate
relation
and
the
association
table
is
owned
by
both
ends
.
For
example
in
the
case
of
users
and
groups
when
user
is
being
deleted
the
groups
it
belongs
to
are
not
being
deleted
and
the
associations
between
this
user
and
the
groups
it
belongs
to
are
being
deleted
.
<
br
\
><
br
\
>
Sometimes
you
may
not
want
that
association
table
rows
are
being
deleted
when
user
/
group
is
being
deleted
.
You
can
override
this
behoviour
by
setting
the
relations
to
association
component
(
in
this
case
Groupuser
)
explicitly
.
<
br
\
><
br
\
>
In
the
following
example
we
have
Groups
and
Users
of
which
relation
is
defined
as
many
-
to
-
many
.
In
this
case
we
also
need
to
define
an
additional
class
called
Groupuser
.
manual/documentation.php
View file @
45bca035
...
...
@@ -32,7 +32,9 @@ function render($title,$t,$e) {
if
(
file_exists
(
"codes/
$title
-
$t
.php"
))
{
print
"<table border=1 class='dashed' cellpadding=0 cellspacing=0>"
;
print
"<tr><td>"
;
$c
=
file_get_contents
(
"codes/
$title
-
$t
.php"
);
$c
=
file_get_contents
(
"codes/
$title
-
$t
.php"
);
$c
=
trim
(
$c
);
$h
->
loadString
(
$c
);
print
$h
->
toHtml
();
print
"</td></tr>"
;
...
...
@@ -52,13 +54,18 @@ function render_block($name) {
}
}
if
(
file_exists
(
"codes/
$name
.php"
))
{
print
"<table width=500 border=1 class='dashed' cellpadding=0 cellspacing=0>"
;
print
"<tr><td>"
;
$c
=
file_get_contents
(
"codes/
$name
.php"
);
$c
=
trim
(
$c
);
if
(
!
empty
(
$c
))
{
$h
->
loadString
(
$c
);
print
"<table width=500 border=1 class='dashed' cellpadding=0 cellspacing=0>"
;
print
"<tr><td>"
;
print
$h
->
toHtml
();
print
"</td></tr>"
;
print
"</table>"
;
}
}
}
function
array2path
(
$array
,
$path
=
''
)
{
...
...
@@ -189,7 +196,8 @@ $menu = array("Getting started" =>
"Creating related records"
,
"Retrieving related records"
,
"Updating related records"
,
"Deleting related records"
),
"Deleting related records"
,
"Working with associations"
),
"Inheritance"
=>
array
(
"One table many classes"
,
"One table one class"
,
...
...
@@ -315,6 +323,7 @@ $menu = array("Getting started" =>
"Real world examples"
=>
array
(
"User management system"
,
"Forum application"
,
"Album lister"
)
);
?>
...
...
@@ -352,14 +361,16 @@ $menu = array("Getting started" =>
if
(
!
file_exists
(
"docs/
$title
-
$k
-
$v2
.php"
))
{
$missing
[
0
]
++
;
$str
.=
" [ <font color='red'>doc</font> ] "
;
//touch("docs/$title - $k - $v2.php");
}
if
(
!
file_exists
(
"codes/
$title
-
$k
-
$v2
.php"
))
{
$missing
[
1
]
++
;
$str
.=
" [ <font color='red'>code</font> ] "
;
//touch("codes/$title - $k - $v2.php");
}
$e
=
implode
(
"."
,
array
(
$i
,
$i2
,
$i3
));
print
"<dd><dd>"
.
$e
.
" <a href=
\"
"
.
$_SERVER
[
'PHP_SELF'
]
.
"?index=
$i
.
$i2
#
$e
\"
>"
.
$v2
.
"</a><br>
\n
"
;
print
"<dd><dd>"
.
$e
.
" <a href=
\"
"
.
$_SERVER
[
'PHP_SELF'
]
.
"?index=
$i
.
$i2
#
$e
\"
>"
.
$v2
.
"</a>
$str
<br>
\n
"
;
$i3
++
;
}
}
else
{
...
...
@@ -367,12 +378,14 @@ $menu = array("Getting started" =>
if
(
!
file_exists
(
"docs/
$title
-
$t
.php"
))
{
$missing
[
0
]
++
;
$str
.=
" [ <font color='red'>doc</font> ] "
;
//touch("docs/$title - $t.php");
}
if
(
!
file_exists
(
"codes/
$title
-
$t
.php"
))
{
$missing
[
1
]
++
;
$str
.=
" [ <font color='red'>code</font> ] "
;
//touch("codes/$title - $t.php");
}
print
"<dd>"
.
$e
.
" <a href=
\"
"
.
$_SERVER
[
'PHP_SELF'
]
.
"?index=
$i
#
$e
\"
>"
.
$t
.
"</a><br>
\n
"
;
print
"<dd>"
.
$e
.
" <a href=
\"
"
.
$_SERVER
[
'PHP_SELF'
]
.
"?index=
$i
#
$e
\"
>"
.
$t
.
"</a>
$str
<br>
\n
"
;
}
$i2
++
;
}
...
...
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