Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1432291
DoctrineCollectionFilter.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
788 B
Referenced Files
None
Subscribers
None
DoctrineCollectionFilter.php
View Options
<?php
namespace
DeepCopy\Filter\Doctrine
;
use
DeepCopy\Filter\Filter
;
use
DeepCopy\Reflection\ReflectionHelper
;
/**
* @final
*/
class
DoctrineCollectionFilter
implements
Filter
{
/**
* Copies the object property doctrine collection.
*
* {@inheritdoc}
*/
public
function
apply
(
$object
,
$property
,
$objectCopier
)
{
$reflectionProperty
=
ReflectionHelper
::
getProperty
(
$object
,
$property
);
$reflectionProperty
->
setAccessible
(
true
);
$oldCollection
=
$reflectionProperty
->
getValue
(
$object
);
$newCollection
=
$oldCollection
->
map
(
function
(
$item
)
use
(
$objectCopier
)
{
return
$objectCopier
(
$item
);
}
);
$reflectionProperty
->
setValue
(
$object
,
$newCollection
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 16, 21:36 (1 d, 7 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
71/99/422eabac9e22ee9411588e30acc6
Default Alt Text
DoctrineCollectionFilter.php (788 B)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment