|
|
|
@ -11,7 +11,6 @@ use Kartierung\Analyze\Result\RepositoryMethodParameter;
|
|
|
|
use Kartierung\Analyze\Result\RepositoryResult;
|
|
|
|
use Kartierung\Analyze\Result\RepositoryResult;
|
|
|
|
use Kartierung\Attribute\ListOf;
|
|
|
|
use Kartierung\Attribute\ListOf;
|
|
|
|
use Kartierung\Attribute\Query;
|
|
|
|
use Kartierung\Attribute\Query;
|
|
|
|
use Kartierung\Repository\ResolutionStrategy\ResolutionStrategyFactory;
|
|
|
|
|
|
|
|
use ReflectionClass;
|
|
|
|
use ReflectionClass;
|
|
|
|
use ReflectionIntersectionType;
|
|
|
|
use ReflectionIntersectionType;
|
|
|
|
use ReflectionMethod;
|
|
|
|
use ReflectionMethod;
|
|
|
|
@ -23,11 +22,6 @@ use ReflectionUnionType;
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
readonly class RepositoryAnalyzer
|
|
|
|
readonly class RepositoryAnalyzer
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
public function __construct(
|
|
|
|
|
|
|
|
private ResolutionStrategyFactory $methodValidator
|
|
|
|
|
|
|
|
) {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @param class-string<R> $repositoryClass
|
|
|
|
* @param class-string<R> $repositoryClass
|
|
|
|
* @noinspection PhpDocMissingThrowsInspection
|
|
|
|
* @noinspection PhpDocMissingThrowsInspection
|
|
|
|
@ -40,6 +34,7 @@ readonly class RepositoryAnalyzer
|
|
|
|
$refClass = new ReflectionClass($repositoryClass);
|
|
|
|
$refClass = new ReflectionClass($repositoryClass);
|
|
|
|
|
|
|
|
|
|
|
|
return new RepositoryResult(
|
|
|
|
return new RepositoryResult(
|
|
|
|
|
|
|
|
repoFqcn: $repositoryClass,
|
|
|
|
methods: $this->methods($refClass)
|
|
|
|
methods: $this->methods($refClass)
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -60,15 +55,6 @@ readonly class RepositoryAnalyzer
|
|
|
|
$params = $this->parameters($refMethod);
|
|
|
|
$params = $this->parameters($refMethod);
|
|
|
|
|
|
|
|
|
|
|
|
$name = $refMethod->name;
|
|
|
|
$name = $refMethod->name;
|
|
|
|
$resolutionStrategy = $this->methodValidator->forRepositoryMethod(
|
|
|
|
|
|
|
|
repName: $refClass->name,
|
|
|
|
|
|
|
|
methodName: $name,
|
|
|
|
|
|
|
|
query: $query,
|
|
|
|
|
|
|
|
returnType: $returnType,
|
|
|
|
|
|
|
|
returnsNullable: $returnsNullable,
|
|
|
|
|
|
|
|
listType: $listType,
|
|
|
|
|
|
|
|
params: $params
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$methods[$refMethod->name] = new RepositoryMethod(
|
|
|
|
$methods[$refMethod->name] = new RepositoryMethod(
|
|
|
|
query: $query,
|
|
|
|
query: $query,
|
|
|
|
@ -77,7 +63,6 @@ readonly class RepositoryAnalyzer
|
|
|
|
returnListType: $listType,
|
|
|
|
returnListType: $listType,
|
|
|
|
name: $name,
|
|
|
|
name: $name,
|
|
|
|
parameters: $params,
|
|
|
|
parameters: $params,
|
|
|
|
resolutionStrategy: $resolutionStrategy
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|