Files
rmphp-storage/src/Entity/AbstractEntity.php
2025-04-13 12:45:30 +03:00

40 lines
698 B
PHP

<?php
namespace Rmphp\Storage\Entity;
abstract class AbstractEntity implements EntityInterface {
/**
* @return mixed
*/
public function getId(): mixed {
return (isset($this->id)) ? (($this->id instanceof ValueObjectInterface) ? $this->id->getValue() : $this->id) : null;
}
/**
* @param string $name
* @param $value
* @return void
*/
public function __set(string $name, $value): void {
$this->$name = $value;
}
/**
* @param string $name
* @return string
*/
public function __get(string $name) {
return $this->$name ?? null;
}
/**
* @param string $name
* @return bool
*/
public function __isset(string $name): bool {
return isset($this->$name);
}
}