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
375c470e
Commit
375c470e
authored
Jan 06, 2010
by
beberlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DDC-155 - Skip __sleep in generateMethods
parent
9f9cc487
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletion
+27
-1
ProxyFactory.php
lib/Doctrine/ORM/Proxy/ProxyFactory.php
+2
-1
ProxyClassGeneratorTest.php
tests/Doctrine/Tests/ORM/Proxy/ProxyClassGeneratorTest.php
+25
-0
No files found.
lib/Doctrine/ORM/Proxy/ProxyFactory.php
View file @
375c470e
...
...
@@ -165,7 +165,8 @@ class ProxyFactory
$methods
=
''
;
foreach
(
$class
->
reflClass
->
getMethods
()
as
$method
)
{
if
(
$method
->
isConstructor
())
{
/* @var $method ReflectionMethod */
if
(
$method
->
isConstructor
()
||
strtolower
(
$method
->
getName
())
==
"__sleep"
)
{
continue
;
}
...
...
tests/Doctrine/Tests/ORM/Proxy/ProxyClassGeneratorTest.php
View file @
375c470e
...
...
@@ -124,6 +124,21 @@ class ProxyClassGeneratorTest extends \Doctrine\Tests\OrmTestCase
$this
->
assertNotContains
(
"class DoctrineOrmTestEntityProxy extends
\\\\
DoctrineOrmTestEntity"
,
$classCode
);
$this
->
assertContains
(
"class DoctrineOrmTestEntityProxy extends
\\
DoctrineOrmTestEntity"
,
$classCode
);
}
public
function
testClassWithSleepProxyGeneration
()
{
$className
=
"\Doctrine\Tests\ORM\Proxy\SleepClass"
;
$proxyName
=
"DoctrineTestsORMProxySleepClassProxy"
;
$classMetadata
=
new
\Doctrine\ORM\Mapping\ClassMetadata
(
$className
);
$classMetadata
->
mapField
(
array
(
'fieldName'
=>
'id'
,
'type'
=>
'integer'
));
$classMetadata
->
setIdentifier
(
array
(
'id'
));
$this
->
_proxyFactory
->
generateProxyClasses
(
array
(
$classMetadata
));
$classCode
=
file_get_contents
(
dirname
(
__FILE__
)
.
"/generated/"
.
$proxyName
.
".php"
);
$this
->
assertEquals
(
1
,
substr_count
(
$classCode
,
'function __sleep'
));
}
protected
function
_getMockPersister
()
{
...
...
@@ -131,3 +146,13 @@ class ProxyClassGeneratorTest extends \Doctrine\Tests\OrmTestCase
return
$persister
;
}
}
class
SleepClass
{
public
$id
;
public
function
__sleep
()
{
return
array
(
'id'
);
}
}
\ No newline at end of file
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