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
7157693d
Commit
7157693d
authored
Mar 26, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
a03d7c6c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
Object relational mapping - Relations - Foreign key constraints - Introduction.php
... - Relations - Foreign key constraints - Introduction.php
+8
-3
No files found.
manual/docs/Object relational mapping - Relations - Foreign key constraints - Introduction.php
View file @
7157693d
...
...
@@ -27,7 +27,11 @@ class Order extends Doctrine_Record
}
public function setUp()
{
$this->hasOne('
Product
', '
Order
.
product_id
', array('
constraint
' => true));
$this->hasOne('
Product
', '
Order
.
product_id
');
// foreign key columns should *always* have indexes
$this->index('
product_id
', array('
fields
' => '
product_id
'));
}
}
</code>
...
...
@@ -36,8 +40,9 @@ When exported the class 'Order' would execute the following sql:
CREATE
TABLE
orders
(
order_id
integer
PRIMARY
KEY
,
product_no
integer
REFERENCES
products
(
id
),
quantity
integer
product_id
integer
REFERENCES
products
(
id
),
quantity
integer
,
INDEX
product_id_idx
(
product_id
)
)
Now
it
is
impossible
to
create
orders
with
product_no
entries
that
do
not
appear
in
the
products
table
.
...
...
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