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
1d1f0556
Commit
1d1f0556
authored
Dec 14, 2006
by
chtito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allowing customisation of the invokers prefixes
parent
ac34e4bf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
4 deletions
+22
-4
Doctrine.php
lib/Doctrine.php
+8
-0
Configurable.php
lib/Doctrine/Configurable.php
+3
-1
Table.php
lib/Doctrine/Table.php
+11
-3
No files found.
lib/Doctrine.php
View file @
1d1f0556
...
...
@@ -121,6 +121,14 @@ final class Doctrine {
* accessor invoking attribute
*/
const
ATTR_ACCESSORS
=
18
;
/**
* accessor invoking prefix get
*/
const
ATTR_ACCESSOR_PREFIX_GET
=
22
;
/**
* accessor invoking prefix set
*/
const
ATTR_ACCESSOR_PREFIX_SET
=
23
;
...
...
lib/Doctrine/Configurable.php
View file @
1d1f0556
...
...
@@ -119,6 +119,8 @@ abstract class Doctrine_Configurable {
case
Doctrine
::
ATTR_QUOTE_IDENTIFIER
:
case
Doctrine
::
ATTR_PORTABILITY
:
case
Doctrine
::
ATTR_DEFAULT_TABLE_TYPE
:
case
Doctrine
::
ATTR_ACCESSOR_PREFIX_GET
:
case
Doctrine
::
ATTR_ACCESSOR_PREFIX_SET
:
break
;
case
Doctrine
::
ATTR_SEQCOL_NAME
:
...
...
@@ -203,7 +205,7 @@ abstract class Doctrine_Configurable {
public
function
getAttribute
(
$attribute
)
{
$attribute
=
(
int
)
$attribute
;
if
(
$attribute
<
1
||
$attribute
>
2
1
)
if
(
$attribute
<
1
||
$attribute
>
2
3
)
throw
new
Doctrine_Exception
(
'Unknown attribute.'
);
if
(
!
isset
(
$this
->
attributes
[
$attribute
]))
{
...
...
lib/Doctrine/Table.php
View file @
1d1f0556
...
...
@@ -1009,9 +1009,13 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
*/
public
function
invokeSet
(
Doctrine_Record
$record
,
$name
,
$value
)
{
if
(
!
(
$this
->
getAttribute
(
Doctrine
::
ATTR_ACCESSORS
)
&
Doctrine
::
ACCESSOR_SET
))
return
$value
;
return
$value
;
$prefix
=
$this
->
getAttribute
(
Doctrine
::
ATTR_ACCESSOR_PREFIX_SET
);
if
(
!
$prefix
)
$prefix
=
'set'
;
$method
=
'set'
.
$name
;
$method
=
$prefix
.
$name
;
if
(
method_exists
(
$record
,
$method
))
{
return
$record
->
$method
(
$value
);
...
...
@@ -1028,7 +1032,11 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
if
(
!
(
$this
->
getAttribute
(
Doctrine
::
ATTR_ACCESSORS
)
&
Doctrine
::
ACCESSOR_GET
))
return
$value
;
$method
=
'get'
.
$name
;
$prefix
=
$this
->
getAttribute
(
Doctrine
::
ATTR_ACCESSOR_PREFIX_GET
);
if
(
!
$prefix
)
$prefix
=
'get'
;
$method
=
$prefix
.
$name
;
if
(
method_exists
(
$record
,
$method
))
{
return
$record
->
$method
(
$value
);
...
...
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