diff --git a/composer.json b/composer.json
index 847369f0cc75d4c34dbd9bf38cb3317ebfbf4316..1f7d5643b07eae844705c2188e4998e2b528e49c 100644
--- a/composer.json
+++ b/composer.json
@@ -24,7 +24,7 @@
     "require": {
         "php": "^8.0",
         "dibi/dibi": "^4.0.2",
-        "grifart/scaffolder": "^0.4.0",
+        "grifart/scaffolder": "^0.5.0",
         "nette/utils": "^3.0.1"
     },
     "require-dev": {
diff --git a/src/Scaffolding/ModificationsDecorator.php b/src/Scaffolding/ModificationsDecorator.php
index 049fc6e7631728af5b3b8f581b59c58a77ed176d..ea97881d825264cbf0e88914944bdfae9cd8badf 100644
--- a/src/Scaffolding/ModificationsDecorator.php
+++ b/src/Scaffolding/ModificationsDecorator.php
@@ -10,6 +10,7 @@ use Grifart\Tables\ModificationsTrait;
 use Nette\PhpGenerator\ClassType;
 use Nette\PhpGenerator\Parameter;
 use Nette\PhpGenerator\PhpLiteral;
+use Nette\PhpGenerator\PhpNamespace;
 
 final class ModificationsDecorator implements ClassDecorator
 {
@@ -28,11 +29,8 @@ final class ModificationsDecorator implements ClassDecorator
 	}
 
 
-	public function decorate(ClassType $classType, ClassDefinition $definition): void
+	public function decorate(PhpNamespace $namespace, ClassType $classType, ClassDefinition $definition): void
 	{
-		$namespace = $classType->getNamespace();
-		\assert($namespace !== NULL, 'Class Generator always generate class in namespace.');
-
 		$namespace->addUse(ModificationsTrait::class);
 		$classType->addTrait(ModificationsTrait::class);
 
@@ -47,7 +45,7 @@ final class ModificationsDecorator implements ClassDecorator
 			->setReturnType('self')
 			->setParameters([
 				(new Parameter('primaryKey'))
-					->setTypeHint($this->primaryKeyClass)
+					->setType($this->primaryKeyClass)
 			])
 			->setBody('return self::_update($primaryKey);');
 
@@ -68,7 +66,10 @@ final class ModificationsDecorator implements ClassDecorator
 			]);
 
 		// modify*() methods
-		foreach ($definition->getFields() as $fieldName => $type) {
+		foreach ($definition->getFields() as $field) {
+			$fieldName = $field->getName();
+			$type = $field->getType();
+
 			// add getter
 			$modifier = $classType->addMethod('modify' . \ucfirst($fieldName))
 				->setVisibility('public')
@@ -90,10 +91,9 @@ final class ModificationsDecorator implements ClassDecorator
 				$docCommentType = $type->getDocCommentType($namespace);
 
 				$modifier->addComment(\sprintf(
-					'@param %s $%s%s',
+					'@param %s $%s',
 					$docCommentType,
 					$fieldName,
-					$type->hasComment() ? ' ' . $type->getComment($namespace) : '',
 				));
 			}
 		}
diff --git a/src/Scaffolding/PrivateConstructorDecorator.php b/src/Scaffolding/PrivateConstructorDecorator.php
index 0889283bc8501ad4bd0a1d90bab1a2caa25711f4..10a36db4358c84eeb5e7071f5a96fec9bec3e91a 100644
--- a/src/Scaffolding/PrivateConstructorDecorator.php
+++ b/src/Scaffolding/PrivateConstructorDecorator.php
@@ -5,11 +5,12 @@ namespace Grifart\Tables\Scaffolding;
 use Grifart\ClassScaffolder\Decorators\ClassDecorator;
 use Grifart\ClassScaffolder\Definition\ClassDefinition;
 use Nette\PhpGenerator\ClassType;
+use Nette\PhpGenerator\PhpNamespace;
 
 final class PrivateConstructorDecorator implements ClassDecorator
 {
 
-	public function decorate(ClassType $classType, ClassDefinition $definition): void
+	public function decorate(PhpNamespace $namespace, ClassType $classType, ClassDefinition $definition): void
 	{
 		$classType->getMethod('__construct')->setPrivate();
 	}
diff --git a/src/Scaffolding/ReconstituteConstructorDecorator.php b/src/Scaffolding/ReconstituteConstructorDecorator.php
index e2739f939588db64df6738f5d1945e615f720693..b2c2fb6fb8a6517f5b928e032d65f26889f1bd75 100644
--- a/src/Scaffolding/ReconstituteConstructorDecorator.php
+++ b/src/Scaffolding/ReconstituteConstructorDecorator.php
@@ -11,7 +11,7 @@ use Nette\PhpGenerator\Property;
 final class ReconstituteConstructorDecorator implements ClassDecorator
 {
 
-	public function decorate(ClassType $classType, ClassDefinition $definition): void
+	public function decorate(Code\PhpNamespace $namespace, ClassType $classType, ClassDefinition $definition): void
 	{
 		$reconstitute = $classType->addMethod('reconstitute')
 			->setReturnType('static')
diff --git a/src/Scaffolding/TableDecorator.php b/src/Scaffolding/TableDecorator.php
index 61b8328974644785381995dcdaaa74f1a28a907a..0615f55041c2e082a982a49627688ee223a49e94 100644
--- a/src/Scaffolding/TableDecorator.php
+++ b/src/Scaffolding/TableDecorator.php
@@ -5,7 +5,6 @@ namespace Grifart\Tables\Scaffolding;
 
 
 use Grifart\ClassScaffolder\Decorators\ClassDecorator;
-use Grifart\ClassScaffolder\Decorators\DecoratorTools;
 use Grifart\ClassScaffolder\Definition\ClassDefinition;
 use Grifart\ClassScaffolder\Definition\Types\Type;
 use Grifart\Tables\CaseConvertion;
@@ -53,10 +52,8 @@ final class TableDecorator implements ClassDecorator
 	}
 
 
-	public function decorate(Code\ClassType $classType, ClassDefinition $definition): void
+	public function decorate(Code\PhpNamespace $namespace, Code\ClassType $classType, ClassDefinition $definition): void
 	{
-		$namespace = DecoratorTools::extractNamespace($classType);
-
 		// implements table
 		$namespace->addUse(Table::class);
 		$classType->addImplement(Table::class);
@@ -101,7 +98,7 @@ final class TableDecorator implements ClassDecorator
 		$classType->addMethod('find')
 			->setParameters([
 				(new Code\Parameter('primaryKey'))
-					->setTypeHint($this->primaryKeyClass)
+					->setType($this->primaryKeyClass)
 			])
 			->setReturnType($this->rowClass)
 			->setReturnNullable()
@@ -116,7 +113,7 @@ final class TableDecorator implements ClassDecorator
 		$classType->addMethod('get')
 			->setParameters([
 				(new Code\Parameter('primaryKey'))
-					->setTypeHint($this->primaryKeyClass)
+					->setType($this->primaryKeyClass)
 			])
 			->setReturnType($this->rowClass)
 			->addComment('@throws RowNotFound')
@@ -131,7 +128,7 @@ final class TableDecorator implements ClassDecorator
 		$classType->addMethod('findBy')
 			->setParameters([
 				(new Code\Parameter('conditions'))
-					->setTypeHint('array')
+					->setType('array')
 			])
 			->setComment('@return ' . $namespace->unresolveName($this->rowClass) . '[]')
 			->setReturnType('array')
@@ -169,10 +166,9 @@ final class TableDecorator implements ClassDecorator
 
 				if ($fieldType->requiresDocComment()) {
 					$newMethod->addComment(\sprintf(
-						'@param %s $%s%s',
+						'@param %s $%s',
 						$fieldType->getDocCommentType($namespace),
 						$fieldName,
-						$fieldType->hasComment() ? ' ' . $fieldType->getComment($namespace) : '',
 					));
 				}