diff --git a/src/Annotation/Property/Field.php b/src/Annotation/Property/Field.php index cfbf886..7b8dea0 100644 --- a/src/Annotation/Property/Field.php +++ b/src/Annotation/Property/Field.php @@ -8,7 +8,7 @@ class Field implements \Notes\Annotation { public string $name; - public int $length; + public int|string $length; public int $precision; diff --git a/src/Repository.php b/src/Repository.php index 8c8992d..2e30078 100644 --- a/src/Repository.php +++ b/src/Repository.php @@ -144,6 +144,15 @@ class Repository } } + public function clone(object|array $entity) : bool + { + foreach(Ulmus::resolveEntity($this->entityClass)->getPrimaryKeyField() as $key => $field) { + unset($entity->$key); + } + + return $this->save($entity); + } + public function save(object|array $entity, ? array $fieldsAndValue = null, bool $replace = false) : bool { if ( is_array($entity) ) {