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
db433c84
Commit
db433c84
authored
Oct 12, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #163, #162, removed Doctrine_Record::__call()
parent
3b248377
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
16 deletions
+65
-16
Record.php
lib/Doctrine/Record.php
+53
-13
QuerySelectTestCase.php
tests/QuerySelectTestCase.php
+7
-0
RecordTestCase.php
tests/RecordTestCase.php
+5
-3
No files found.
lib/Doctrine/Record.php
View file @
db433c84
...
...
@@ -1385,23 +1385,63 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
}
}
}
public
function
setAttribute
(
$attr
,
$value
)
{
$this
->
table
->
setAttribute
(
$attr
,
$value
);
}
public
function
setTableName
(
$tableName
)
{
$this
->
table
->
setTableName
(
$tableName
);
}
public
function
setInheritanceMap
(
$map
)
{
$this
->
table
->
setInheritanceMap
(
$map
);
}
public
function
setEnumValues
(
$column
,
$values
)
{
$this
->
table
->
setEnumValues
(
$column
,
$values
);
}
/**
* __call
* @param string $m
* @param array $a
* addListener
*
* @param Doctrine_DB_EventListener_Interface|Doctrine_Overloadable $listener
* @return Doctrine_DB
*/
public
function
__call
(
$m
,
$a
)
{
if
(
method_exists
(
$this
->
table
,
$m
))
return
call_user_func_array
(
array
(
$this
->
table
,
$m
),
$a
);
if
(
!
function_exists
(
$m
))
throw
new
Doctrine_Record_Exception
(
"unknown callback '
$m
'"
);
public
function
addListener
(
$listener
,
$name
=
null
)
{
$this
->
table
->
addListener
(
$listener
,
$name
=
null
);
return
$this
;
}
/**
* getListener
*
* @return Doctrine_DB_EventListener_Interface|Doctrine_Overloadable
*/
public
function
getListener
()
{
return
$this
->
table
->
getListener
();
}
/**
* setListener
*
* @param Doctrine_DB_EventListener_Interface|Doctrine_Overloadable $listener
* @return Doctrine_DB
*/
public
function
setListener
(
$listener
)
{
$this
->
table
->
setListener
(
$listener
);
return
$this
;
}
/**
* call
*
* @param string|array $callback valid callback
* @param string $column column name
* @param mixed arg1 ... argN optional callback arguments
* @return Doctrine_Record
*/
public
function
call
(
$callback
,
$column
)
{
$args
=
func_get_args
();
array_shift
(
$args
);
if
(
isset
(
$a
[
0
]))
{
$column
=
$a
[
0
];
$a
[
0
]
=
$this
->
get
(
$column
);
if
(
isset
(
$a
rgs
[
0
]))
{
$column
=
$a
rgs
[
0
];
$a
rgs
[
0
]
=
$this
->
get
(
$column
);
$newvalue
=
call_user_func_array
(
$
m
,
$a
);
$newvalue
=
call_user_func_array
(
$
callback
,
$args
);
$this
->
data
[
$column
]
=
$newvalue
;
}
...
...
tests/QuerySelectTestCase.php
0 → 100644
View file @
db433c84
<?php
class
Doctrine_Query_Select_TestCase
extends
Doctrine_UnitTestCase
{
public
function
testAsteriskSelecting
()
{
}
}
?>
tests/RecordTestCase.php
View file @
db433c84
...
...
@@ -21,7 +21,9 @@ class Doctrine_RecordTestCase extends Doctrine_UnitTestCase {
$this
->
assertFalse
(
isset
(
$user
[
'id'
]));
$this
->
assertFalse
(
$user
->
contains
(
'id'
));
}
public
function
testUnknownColumn
()
{
}
public
function
testNotNullConstraint
()
{
$null
=
new
NotNullTest
();
...
...
@@ -287,9 +289,9 @@ class Doctrine_RecordTestCase extends Doctrine_UnitTestCase {
public
function
testCallback
()
{
$user
=
new
User
();
$user
->
name
=
" zYne "
;
$user
->
trim
(
'name'
);
$user
->
call
(
'trim'
,
'name'
);
$this
->
assertEqual
(
$user
->
name
,
'zYne'
);
$user
->
substr
(
'name'
,
0
,
1
);
$user
->
call
(
'substr'
,
'name'
,
0
,
1
);
$this
->
assertEqual
(
$user
->
name
,
'z'
);
}
...
...
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