ZF-Commons / ZfcUser

A generic user registration and authentication module for ZF2. Supports Zend\Db and Doctrine2. (Formerly EdpUser)
BSD 3-Clause "New" or "Revised" License
497 stars 343 forks source link

Custom user entity class results in Exception #177

Closed dhaarbrink closed 11 years ago

dhaarbrink commented 11 years ago

I have defined a custom user entity class, but I get an exception: exception 'ZfcUser\Exception\DomainException' with message '$user is not an instance of User'

It is triggered here: ZfcUser\View\Helper\ZfcUserDisplayName:28

The check on line 27 of that file should read from the config and check if there is a custom class defined, AND satisfies the requirement that it should at least have a couple of methods defined: getDisplayName(), getUserName() and getEmail().

For now I don't see a way around this and resorted to manually disabling the check, which means I can't deploy to production at the moment (since I'm using composer).

akrabat commented 11 years ago

If you look at the top of the file, you'll see:

use ZfcUser\Entity\UserInterface as User;

This means that your new custom class simply needs to implement this interface and it will then work.

dhaarbrink commented 11 years ago

Doh! I'll go and get more coffee :)

Sorry to bother you!