diff --git a/app/src/Domain/Entity/Category.php b/app/src/Domain/Entity/Category.php new file mode 100644 index 0000000..8a1d38f --- /dev/null +++ b/app/src/Domain/Entity/Category.php @@ -0,0 +1,41 @@ +name; + } + + /** + * @param array $props Key is each property of the entity + */ + public static function fromArray(array $props): self + { + $category = new self($props['name']); + + if ($props['id']) { + $category->setId($props['id']); + } + + if ($props['createdAt']) { + $category->setCreatedAt($props['createdAt']); + } + + if ($props['updatedAt']) { + $category->setUpdatedAt($props['updatedAt']); + } + + return $category; + } +}