Recommend this page to a friend! |
![]() |
Info | Documentation | ![]() |
![]() |
![]() |
Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not yet rated by the users | Total: 96 | All time: 9,863 This week: 660![]() |
Version | License | PHP version | Categories | |||
copy-object-attribut 1.0.0 | MIT/X Consortium ... | 7 | Language, PHP 7 |
Description | Author | |||
This class can copy the values of attributes to another object. Innovation Award
|
Simple helper to copy attributes values with the same name from one object to an other.
composer require deoliveiralucas/copy-object-attributes-values
use CopyObjectAttributesValues\CopyObjectAttributesValues;
class ObjectA {
private $attributeA = 'ObjectA_AttrA';
private $attributeB = 'ObjectA_AttrB';
}
class ObjectB {
private $attributeA = 'ObjectB_AttrA';
private $attributeB = 'ObjectB_AttrB';
private $attributeC = 'ObjectB_AttrC';
}
$objectA = new ObjectA();
$objectB = new ObjectB();
CopyObjectAttributesValues::from($objectA)->to($objectB);
var_dump($objectB);
/*
Output:
class ObjectB#2 (3) {
private $attributeA =>
string(13) "ObjectA_AttrA"
private $attributeB =>
string(13) "ObjectA_AttrB"
private $attributeC =>
string(13) "ObjectB_AttrC"
}
*/
Please see CONTRIBUTING for details.
CopyObjectAttributesValues is released under the MIT License. Please see License File for more information.
![]() |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
||||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Lic. | License text | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Doc. | Documentation |
![]() |
/ | test |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() ![]() |
Aux. | Auxiliary script |
![]() |
/ | test | / | unit |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
Class | Class source |
![]() |
/ | test | / | unit | / | CopyObjectAttributesValuesTest |
File | Role | Description |
---|---|---|
![]() |
Class | Class source |
![]() |
Class | Class source |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
![]() |
![]() | copy-object-attribut-2019-04-29.zip 16KB |
![]() | copy-object-attribut-2019-04-29.tar.gz 13KB |
![]() | Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.