thecodingmachine / graphqlite

Use PHP Attributes/Annotations to declare your GraphQL API

Home Page:https://graphqlite.thecodingmachine.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ExtendType and Type with class argument don't work

semnickolas opened this issue · comments

Explain please, maybe I don't undestand, but next code doesn't work?! Project develop on PHP 8.2 and Symfony 6

#[Type]
class SomeEntity 
{
     public function getSome(): string
    {
        return 'some text';
    }
}

#[ExtendType(class: SomeEntity::class)] //tried #[Type(class: SomeEntity::class)] - no result
class SomeType 
{
    #[Field]
    public function getSome(SomeEntity $source): string
    {
        return $source->getSome() . ' text';
    }
}


class SomeController
{
    #[Query(name: 'someTestQuery')]
    /**
     * @return SomeType[]|SomeEntity[] // tried single return type with both variants, no results
     */
    public function someAction(): array
    {
        return [new SomeEntity()];
    }
}