在 运行 时间 PHP 实现接口
Implement Interface at run-time PHP
您好,我正在使用 slim 和 cartalyst\sentinel 开发登录应用程序。当我创建 sentinel reminder $reminder = new Cartalyst\Sentinel\Reminders\IlluminateReminderRepository;
的新实例时,它给出了实现 UserRepositoryInterface error __construct() must implement interface Cartalyst\Sentinel\Users\UserRepositoryInterface
.
的错误
我的问题是如何在 php.
的 运行 时间实现接口
而在上面我使用了激活 class,它也在 src 代码中实现了一个接口,如 class IlluminateActivationRepository implements ActivationRepositoryInterface
但它不会给出错误。
下面的激活 class 工作正常。
$activation = (new Cartalyst\Sentinel\Activations\IlluminateActivationRepository)->create($user);
好的,我通过这个提供的用户存储库对象解决了问题。
$users = $app->container->sentinel->getUserRepository();
$reminder = new Cartalyst\Sentinel\Reminders\IlluminateReminderRepository ( $users );
您好,我正在使用 slim 和 cartalyst\sentinel 开发登录应用程序。当我创建 sentinel reminder $reminder = new Cartalyst\Sentinel\Reminders\IlluminateReminderRepository;
的新实例时,它给出了实现 UserRepositoryInterface error __construct() must implement interface Cartalyst\Sentinel\Users\UserRepositoryInterface
.
我的问题是如何在 php.
的 运行 时间实现接口而在上面我使用了激活 class,它也在 src 代码中实现了一个接口,如 class IlluminateActivationRepository implements ActivationRepositoryInterface
但它不会给出错误。
下面的激活 class 工作正常。
$activation = (new Cartalyst\Sentinel\Activations\IlluminateActivationRepository)->create($user);
好的,我通过这个提供的用户存储库对象解决了问题。
$users = $app->container->sentinel->getUserRepository();
$reminder = new Cartalyst\Sentinel\Reminders\IlluminateReminderRepository ( $users );