init
This commit is contained in:
23
mysyde/common/traits/arrayGettableTrait.php
Normal file
23
mysyde/common/traits/arrayGettableTrait.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
namespace DynCom\mysyde\common\traits;
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Bauer
|
||||
* Date: 16.07.2015
|
||||
* Time: 12:55
|
||||
*/
|
||||
trait arrayGettableTrait
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getAllFieldsAsArray() {
|
||||
$ref = new \ReflectionClass($this);
|
||||
$arr = [];
|
||||
foreach ($ref->getProperties() as $property) {
|
||||
$name = $property->name;
|
||||
$arr[$name] = clone $this->$name;
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user