- WIP on Migration of MsSQL

This commit is contained in:
Dave Mc Nicoll committed 2025-05-21 18:46:34 +00:00
1 parent c54de30069
commit fb4985160a
17 files changed
+252 -175

No files matched your search

+8 -5
View File
@@ -111,15 +111,17 @@ class DatasetHandler
return $unmatched;
}
public function pullRelation(object $entity) : Generator
public function pullRelation(object $entity, bool $onlyPreviouslyLoaded = true) : Generator
{
foreach($this->entityResolver->reflectedClass->getProperties(true) as $name => $field){
foreach($this->entityResolver->reflectedClass->getProperties(true) as $name => $field) {
$relation = $this->entityResolver->searchFieldAnnotation($name, [ Relation::class ] );
if ($relation) {
$ignore = $this->entityResolver->searchFieldAnnotation($name, [ Relation\Ignore::class ] );
if ($ignore && $ignore->ignoreExport) {
$load = $onlyPreviouslyLoaded ? (new \ReflectionProperty($entity::class, $name))->isInitialized($entity) : true;
if ( ! $load || ( $ignore && $ignore->ignoreExport ) ) {
if ( $relation->isOneToOne() ) {
# @TODO TO INCLUDED INTO getTypes() RETURNED CLASS WHEN DONE !
yield $name => ( new \ReflectionClass($field->getTypes()[0]) )->newInstanceWithoutConstructor();
@@ -132,9 +134,10 @@ class DatasetHandler
continue;
}
# @TODO Must fix recursive bug.. this last check is way too basic to work
if ( $entity->__isset($name) && ($relation->entity ?? $relation->bridge) !== static::class ) {
if ( null !== $value = $entity->__isset($name) ?? null ) {
$value = $entity->$name ?? null;
if ( null !== $value ) {
if ( is_iterable($value) ) {
$list = [];