- Some bugfixes made in Relation
- Fixed search() methods in EntityCollection - Work done on Relations of EntityTrait ; a lot of work still to be done. It must also move to another file.
This commit is contained in:
1 parent
4d221859fc
commit
8e521025d3
4 files changed
+40
-15
No files matched your search
+2
-2
@@ -83,7 +83,7 @@ trait EntityTrait {
|
||||
|
||||
switch( $relationType ) {
|
||||
case 'onetoone':
|
||||
$repository->where( $baseEntity->field($relation->foreignKey), $this->$field );
|
||||
$repository->where( is_object($relation->foreignKey) ? $relation->foreignKey : $baseEntity->field($relation->foreignKey), $this->$field );
|
||||
|
||||
$this->eventExecute(Event\EntityRelationLoadInterface::class, $name, $repository);
|
||||
|
||||
@@ -96,7 +96,7 @@ trait EntityTrait {
|
||||
return $this->$name = $result[0];
|
||||
|
||||
case 'onetomany':
|
||||
$repository->where( $baseEntity->field($relation->foreignKey), $this->$field);
|
||||
$repository->where( is_object($relation->foreignKey) ? $relation->foreignKey : $baseEntity->field($relation->foreignKey), $this->$field );
|
||||
$this->eventExecute(Event\EntityRelationLoadInterface::class, $name, $repository);
|
||||
|
||||
return $this->$name = call_user_func([$repository, $relation->function]);
|
||||
|
||||
Reference in new issue
Block a user