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
797cdece
Commit
797cdece
authored
May 11, 2007
by
lsmith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- typo fixes
parent
a8fb6cde
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
Object relational mapping - Relations - Inheritance - Column aggregation.php
...apping - Relations - Inheritance - Column aggregation.php
+7
-8
No files found.
manual/docs/Object relational mapping - Relations - Inheritance - Column aggregation.php
View file @
797cdece
...
@@ -5,14 +5,14 @@ The entity table has a column called 'type' which tells whether an entity is a g
...
@@ -5,14 +5,14 @@ The entity table has a column called 'type' which tells whether an entity is a g
The
only
thing
we
have
to
do
is
to
create
3
records
(
the
same
as
before
)
and
add
call
the
Doctrine_Table
::
setInheritanceMap
()
method
inside
the
setUp
()
method
.
The
only
thing
we
have
to
do
is
to
create
3
records
(
the
same
as
before
)
and
add
call
the
Doctrine_Table
::
setInheritanceMap
()
method
inside
the
setUp
()
method
.
<
code
type
=
'php'
>
<
code
type
=
'php'
>
class
Entity
extends
Doctrine_Record
{
class
Entity
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
'name'
,
'string'
,
30
);
$this
->
hasColumn
(
'name'
,
'string'
,
30
);
$this
->
hasColumn
(
'username'
,
'string'
,
20
);
$this
->
hasColumn
(
'username'
,
'string'
,
20
);
$this
->
hasColumn
(
'password'
,
'string'
,
16
);
$this
->
hasColumn
(
'password'
,
'string'
,
16
);
$this
->
hasColumn
(
'created'
,
'integer'
,
11
);
$this
->
hasColumn
(
'created'
,
'integer'
,
11
);
// this column is used for column
// this column is used for column
// aggregation inheritance
// aggregation inheritance
$this
->
hasColumn
(
'type'
,
'integer'
,
11
);
$this
->
hasColumn
(
'type'
,
'integer'
,
11
);
}
}
...
@@ -34,17 +34,17 @@ class Group extends Entity {
...
@@ -34,17 +34,17 @@ class Group extends Entity {
If
we
want
to
be
able
to
fetch
a
record
from
the
Entity
table
and
automatically
get
a
User
record
if
the
Entity
we
fetched
is
a
user
we
have
to
do
set
the
subclasses
option
in
the
parent
class
.
The
adjusted
example
:
If
we
want
to
be
able
to
fetch
a
record
from
the
Entity
table
and
automatically
get
a
User
record
if
the
Entity
we
fetched
is
a
user
we
have
to
do
set
the
subclasses
option
in
the
parent
class
.
The
adjusted
example
:
<
code
type
=
'php'
>
<
code
type
=
'php'
>
class
Entity
extends
Doctrine_Record
{
class
Entity
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
'name'
,
'string'
,
30
);
$this
->
hasColumn
(
'name'
,
'string'
,
30
);
$this
->
hasColumn
(
'username'
,
'string'
,
20
);
$this
->
hasColumn
(
'username'
,
'string'
,
20
);
$this
->
hasColumn
(
'password'
,
'string'
,
16
);
$this
->
hasColumn
(
'password'
,
'string'
,
16
);
$this
->
hasColumn
(
'created'
,
'integer'
,
11
);
$this
->
hasColumn
(
'created'
,
'integer'
,
11
);
// this column is used for column
// this column is used for column
// aggregation inheritance
// aggregation inheritance
$this
->
hasColumn
(
'type'
,
'integer'
,
11
);
$this
->
hasColumn
(
'type'
,
'integer'
,
11
);
$this
->
option
(
'subclasses'
,
array
(
'User'
,
'Group'
);
$this
->
option
(
'subclasses'
,
array
(
'User'
,
'Group'
)
);
}
}
}
}
...
@@ -84,4 +84,3 @@ $group = $q->from('Entity')->where('id=?')->execute(array($group->id))->getFirst
...
@@ -84,4 +84,3 @@ $group = $q->from('Entity')->where('id=?')->execute(array($group->id))->getFirst
</
code
>
</
code
>
The
user
object
is
here
an
instance
of
User
while
the
group
object
is
an
instance
of
Group
.
The
user
object
is
here
an
instance
of
User
while
the
group
object
is
an
instance
of
Group
.
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