- A lot of bugfixes and fitting to accomodate ldap adapter
This commit is contained in:
1 parent
f14347f01d
commit
16d76470da
15 files changed
+350
-216
No files matched your search
+6
-21
@@ -143,27 +143,10 @@ trait EntityTrait {
|
||||
$annotation = $entityResolver->searchFieldAnnotation($key, new Field() );
|
||||
|
||||
if ( isset($this->$key) ) {
|
||||
$realKey = $annotation->name ?? $key;
|
||||
|
||||
switch (true) {
|
||||
case is_object($this->$key):
|
||||
$dataset[$realKey] = Ulmus::convertObject($this->$key);
|
||||
break;
|
||||
|
||||
case is_array($this->$key):
|
||||
$dataset[$realKey] = Ulmus::encodeArray($this->$key);
|
||||
break;
|
||||
|
||||
case is_bool($this->$key):
|
||||
$dataset[$realKey] = (int) $this->$key;
|
||||
break;
|
||||
|
||||
default:
|
||||
$dataset[$realKey] = $this->$key;
|
||||
}
|
||||
$dataset[$annotation->name ?? $key] = static::repository()->adapter->adapter()->writableValue($this->$key);
|
||||
}
|
||||
elseif ( $field['nullable'] ) {
|
||||
$dataset[ $annotation->name ?? $key ] = null;
|
||||
$dataset[$annotation->name ?? $key] = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,9 +180,11 @@ trait EntityTrait {
|
||||
/**
|
||||
* @Ignore
|
||||
*/
|
||||
public function toArray($includeRelations = false) : array
|
||||
public function toArray($includeRelations = false, array $filterFields = null) : array
|
||||
{
|
||||
return $this->entityGetDataset($includeRelations);
|
||||
$dataset = $this->entityGetDataset($includeRelations);
|
||||
|
||||
return $filterFields ? array_intersect_key($dataset, array_flip($filterFields)) : $dataset;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user