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
03d10490
Commit
03d10490
authored
May 15, 2006
by
doctrine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
relation alias bug fixed
parent
7778d2b0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
9 deletions
+51
-9
Sensei.class.php
classes/Sensei/Sensei.class.php
+40
-0
Table.class.php
classes/Table.class.php
+11
-9
No files found.
classes/Sensei/Sensei.class.php
View file @
03d10490
...
...
@@ -6,15 +6,33 @@ class Sensei_User extends Doctrine_Record { }
//class Sensei_Customer extends Sensei_User { }
class
Sensei_Entity
extends
Doctrine_Record
{
/**
* setTableDefinition
* initializes column definitions
*
* @return void
*/
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
"loginname"
,
"string"
,
32
,
"unique"
);
$this
->
hasColumn
(
"password"
,
"string"
,
32
);
}
}
class
Sensei_Variable
extends
Doctrine_Record
{
/**
* setUp
* initializes relations and options
*
* @return void
*/
public
function
setUp
()
{
//$this->setAttribute(Doctrine::ATTR_COLL_KEY, "name");
}
/**
* setTableDefinition
* initializes column definitions
*
* @return void
*/
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
"name"
,
"string"
,
50
,
"unique"
);
$this
->
hasColumn
(
"value"
,
"string"
,
10000
);
...
...
@@ -22,10 +40,22 @@ class Sensei_Variable extends Doctrine_Record {
}
}
class
Sensei_Session
extends
Doctrine_Record
{
/**
* setUp
* initializes relations and options
*
* @return void
*/
public
function
setUp
()
{
$this
->
ownsMany
(
"Sensei_variable"
,
"Sensei_variable.session_id"
);
$this
->
hasOne
(
"Sensei_entity"
,
"Sensei_session.entity_id"
);
}
/**
* setTableDefinition
* initializes column definitions
*
* @return void
*/
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
"session_id"
,
"string"
,
32
);
$this
->
hasColumn
(
"logged_in"
,
"integer"
,
1
);
...
...
@@ -141,6 +171,10 @@ class Sensei extends Doctrine_Access {
}
return
false
;
}
/**
* @param integer $attr
* @param mixed $value
*/
public
function
setAttribute
(
$attr
,
$value
)
{
switch
(
$attr
)
:
case
Sensei
::
ATTR_LIFESPAN
:
...
...
@@ -152,9 +186,15 @@ class Sensei extends Doctrine_Access {
$this
->
attributes
[
$attr
]
=
$value
;
}
/**
* @return boolean
*/
private
function
open
(
$save_path
,
$session_name
)
{
return
true
;
}
/**
* @return boolean
*/
public
function
close
()
{
return
true
;
}
...
...
classes/Table.class.php
View file @
03d10490
...
...
@@ -351,7 +351,15 @@ class Doctrine_Table extends Doctrine_Configurable {
if
(
isset
(
$this
->
relations
[
$name
]))
throw
new
InvalidKeyException
();
$this
->
bound
[
$name
]
=
array
(
$field
,
$type
,
$localKey
);
$e
=
explode
(
" as "
,
$name
);
$name
=
$e
[
0
];
if
(
isset
(
$e
[
1
]))
$alias
=
$e
[
1
];
else
$alias
=
$name
;
$this
->
bound
[
$alias
]
=
array
(
$field
,
$type
,
$localKey
,
$name
);
}
/**
* getComponentName
...
...
@@ -387,14 +395,8 @@ class Doctrine_Table extends Doctrine_Configurable {
$e
=
explode
(
"."
,
$this
->
bound
[
$name
][
0
]);
$component
=
$e
[
0
];
$foreign
=
$e
[
1
];
$e
=
explode
(
" as "
,
$name
);
$name
=
$e
[
0
];
if
(
isset
(
$e
[
1
]))
$alias
=
$e
[
1
];
else
$alias
=
$name
;
$name
=
$this
->
bound
[
$alias
][
3
];
$table
=
$this
->
session
->
getTable
(
$name
);
...
...
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