Giter Club home page Giter Club logo

Comments (9)

philipbrown avatar philipbrown commented on July 28, 2024

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 😄

from cribbb.

keithmifsud avatar keithmifsud commented on July 28, 2024

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.

from cribbb.

philipbrown avatar philipbrown commented on July 28, 2024

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

from cribbb.

keithmifsud avatar keithmifsud commented on July 28, 2024

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.

from cribbb.

philipbrown avatar philipbrown commented on July 28, 2024

The UserId is created from the repository https://github.com/yellowflag/cribbb/blob/master/app/Infrastructure/Repositories/UserDoctrineORMRepository.php#L41

from cribbb.

keithmifsud avatar keithmifsud commented on July 28, 2024

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?

from cribbb.

philipbrown avatar philipbrown commented on July 28, 2024

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

from cribbb.

keithmifsud avatar keithmifsud commented on July 28, 2024

Lol... I didn't see that :)

Thanks.

from cribbb.

philipbrown avatar philipbrown commented on July 28, 2024

No problem 😄 Give me a shout if anything else doesn't make sense!

from cribbb.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.