Bartosz Rychlicki
Bartosz Rychlicki

Reputation: 1918

Doctrine2 entity with interface and type hinting

When Im building a function and want to type hint a param with is an entity that implements given interface I've get an error like this:

AddToFavorite::AddToFavorite() must be an instance of Trendmed\Interfaces\Favoriteable, instance of Proxy\__CG__\Trendmed\Entity\Clinic given

Of course my entity is implementing given interface.

I think it's because the Doctrine proxy classes does not directly implement interfaces that entity class does thus forbiding me from proper interface type hinting. Do You have any solution for that problem?

Upvotes: 1

Views: 1260

Answers (1)

Belac
Belac

Reputation: 1083

I just found this thread, and will add this since others maybe looking.
Put a Use at the top, don't use the full namespace in the function def.

Upvotes: 1

Related Questions