Answer the question
In order to leave comments, you need to log in
Yii2 how to use repository?
Hello. I began to slowly study and implement DDD. Everything seems to be clear, but there is still one question. I have, for example, userServise, the userRepository repository is connected in it, and in this repository is my user model. The repository has methods: save, delete... The
question is: how can I integrate my repository with Yii. With User and UserQuery models? To have the repository method execute $user-save(), $user::find() and $user::find()->active()->male()
Answer the question
In order to leave comments, you need to log in
And what is the difficulty?
class UserRepository {
public function save(User $user)
{
$user->save();
}
public function findMale()
{
return User::find()->active()->male();
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question