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
5a708763
Commit
5a708763
authored
Jul 20, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
bba435d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
0 deletions
+78
-0
Client.php
models/Client.php
+62
-0
SearchTest.php
models/SearchTest.php
+16
-0
No files found.
models/Client.php
0 → 100644
View file @
5a708763
<?php
class
ClientModel
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
setTableName
(
'clients'
);
$this
->
hasColumn
(
'id'
,
'integer'
,
4
,
array
(
'notnull'
=>
true
,
'primary'
=>
true
,
'autoincrement'
=>
true
,
'unsigned'
=>
true
));
$this
->
hasColumn
(
'short_name'
,
'string'
,
32
,
array
(
'notnull'
=>
true
,
'notblank'
,
'unique'
=>
true
));
}
public
function
setUp
()
{
$this
->
hasMany
(
'AddressModel'
,
array
(
'local'
=>
'client_id'
,
'foreign'
=>
'address_id'
,
'refClass'
=>
'ClientToAddressModel'
));
}
}
class
ClientToAddressModel
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
setTableName
(
'clients_to_addresses'
);
$this
->
hasColumn
(
'client_id'
,
'integer'
,
11
,
array
(
'primary'
=>
true
));
$this
->
hasColumn
(
'address_id'
,
'integer'
,
11
,
array
(
'primary'
=>
true
));
}
public
function
construct
()
{
}
public
function
setUp
()
{
$this
->
hasOne
(
'ClientModel'
,
array
(
'local'
=>
'client_id'
,
'foreign'
=>
'id'
,
'onDelete'
=>
'CASCADE'
));
$this
->
hasOne
(
'AddressModel'
,
array
(
'local'
=>
'address_id'
,
'foreign'
=>
'id'
,
'onDelete'
=>
'CASCADE'
));
}
}
class
AddressModel
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
setTableName
(
'addresses'
);
$this
->
hasColumn
(
'id'
,
'integer'
,
11
,
array
(
'autoincrement'
=>
true
,
'primary'
=>
true
));
$this
->
hasColumn
(
'address1'
,
'string'
,
255
,
array
(
'notnull'
=>
true
,
'notblank'
));
$this
->
hasColumn
(
'address2'
,
'string'
,
255
,
array
(
'notnull'
=>
true
));
$this
->
hasColumn
(
'city'
,
'string'
,
255
,
array
(
'notnull'
=>
true
,
'notblank'
));
$this
->
hasColumn
(
'state'
,
'string'
,
10
,
array
(
'notnull'
=>
true
,
'notblank'
,
'usstate'
));
$this
->
hasColumn
(
'zip'
,
'string'
,
15
,
array
(
'notnull'
=>
true
,
'notblank'
,
'regexp'
=>
'/^[0-9-]*$/'
));
}
public
function
setUp
()
{
$this
->
hasMany
(
'ClientModel'
,
array
(
'local'
=>
'address_id'
,
'foreign'
=>
'client_id'
,
'refClass'
=>
'ClientToAddressModel'
));
}
}
models/SearchTest.php
0 → 100644
View file @
5a708763
<?php
class
SearchTest
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
'title'
,
'string'
,
100
);
$this
->
hasColumn
(
'content'
,
'string'
);
}
public
function
setUp
()
{
$options
=
array
(
'generateFiles'
=>
false
,
'fields'
=>
array
(
'title'
,
'content'
));
$this
->
loadTemplate
(
'Doctrine_Search_Template'
,
$options
);
}
}
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