Created
October 28, 2020 10:32
-
-
Save stijn1989/ac3a698549ce81183936707f1f6ad8a9 to your computer and use it in GitHub Desktop.
why i love PHP :D
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function getOriginalEntity(string $entity_class_name) : ?Model | |
{ | |
if(array_key_exists($entity_class_name, $this->entities)) { | |
$entity = $this->entities[ $entity_class_name ]; | |
//copy properties from stdEntity to this entity | |
$stdEntity = $this->getEntity(); | |
foreach($this->entityProperties[ $entity_class_name ] as $property) { | |
$entity->{$property} = $stdEntity->{$property}; | |
} | |
return $entity; | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment