Closed keithmifsud closed 9 years ago
Yeah that's right, I'm mostly not resolving stuff out of the IoC Container yet because I've only written the unit tests so far. Once I start writing the Controllers and wiring stuff together I'll be resolving stuff out of the Container.
So you're right, I'm not at the minute, but I will need to.
Hope that makes sense :smile:
Thanks for the prompt answer Phil :)
I was interested to see how you're resolving the object interfaces such as which implementation of the UUID to use etc.. Will these be done using a service provider? Don't worry about it if this is way too early and you haven't though about it yet.
Yeah that's exactly what I'll be doing :)
However for UUID's in particular I'm just going to be depending on https://github.com/ramsey/uuid
It's possible that I'm missing something here...
The User private constructor requires the $id to be a UserId but neither the static resister nor the UserRegister Service are building the Uuid object or generating the Uuid string. Also since the service is not expecting a Uuid object I don't think that it's generated in Application layers.
The UserId
is created from the repository https://github.com/yellowflag/cribbb/blob/master/app/Infrastructure/Repositories/UserDoctrineORMRepository.php#L41
HI Philip,
Sorry for the long thread of questions but I'm still struggling to understand this particular process.
The service creates the User object: $user = User::register($id, $email, $username, $password);
This static method needs a UserId: public static function register(UserId $userId, Email $email, Username $username, HashedPassword $password) { $user = new User($userId, $email, $username, $password); return $user; }
But the repository is triggered afterwards in the service: $this->userRepository->add($user);
So how is the Uuid generated from the repository to be sent to the User object since botht he static and the constructor require an instance of the Uuid?
The UserId
is requested from the nextIdentity()
method of the repository here https://github.com/yellowflag/cribbb/blob/master/app/Domain/Services/Identity/RegisterUserService.php#L55
Lol... I didn't see that :)
Thanks.
No problem :smile: Give me a shout if anything else doesn't make sense!
Philip,,
You're not resolving your dependencies using a service provider. How are they resolved if they are?
If you're not using the IoC, how are you resolving and implementing the interfaces? Am I missing something?