Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class given does not implement DataObject::class #431

Closed
nomitoor opened this issue May 2, 2023 · 1 comment
Closed

Class given does not implement DataObject::class #431

nomitoor opened this issue May 2, 2023 · 1 comment

Comments

@nomitoor
Copy link

nomitoor commented May 2, 2023

This is what I'm doing

`

class SignupData extends Data
{

public function __construct(
    readonly public string $email,
    readonly public string $password,
    readonly public string $first_name,
    readonly public string $last_name,

    #[DataCollectionOf(ServiceData::class)]
    readonly public DataCollection $personal_service_data,
) {
}

}`

And this is my ServiceData Class

`
class PersonalServiceData extends Data implements DataObject
{

public function __construct( 
    readonly public string $dob,
    readonly public string $state,
    readonly public string $gender,

) {
}

}`

This is throwing me this following error:

Spatie\LaravelData\Exceptions\CannotFindDataClass: Class given does not implement DataObject::class in file /vendor/spatie/laravel-data/src/Attributes/DataCollectionOf.php on line 17

I have tried implementing the DataObject Class to both of these classes but the issue was not fixed.

@rubenvanassche
Copy link
Member

Please do not create an issue when you've already created a discussion about the topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants