I'm trying to figure out the best way to interact with the Customer session using the service layer. I couldn't identify the proper repository to use. Any ideas?

1 Answer 1


Unfortunately, at the moment, there's no implementation of the Customer Session via the Service Contracts.

I'm afraid you'll have to stick to the Magento\Customer\Model\Session class to achieve what you want.

  • 1
    @Rapael at Digital Pianism...yea, I didn't see any implementation when I was digging around...was hoping someone else knew of something I didn't see :'( ... Thanks for confirming this...sigh, one day we'll have a completed service layer...one day!
    – ryanF
    Jun 13, 2016 at 8:58
  • @ryanF well it may take some time but it's good to see people want to use it =) Jun 13, 2016 at 8:59
  • @Raphel at Digital Pianism Yea, the service layer is the way to go...it's also taught in the Fundamentals of Magento 2 Development...so it's funny that's it's taught as best practice, but isn't fully implemented. But I love the idea of creating one layer that can be used for modules and for API interaction...abstracts away details, so that theoretically models/collections could be changed at a later version and my code will still work (as long as interface signature remain backwards compatible ).
    – ryanF
    Jun 13, 2016 at 9:02
  • @ryanF "taught as best practice, but isn't fully implemented" that's not only for the Service Contracts, see here: magento.stackexchange.com/questions/117098/… Jun 13, 2016 at 9:04
  • @Raphail at Digital Pianism, yea I just read that comment a few minutes ago as well...yea, there's still a lot of refactoring to go in the codebase. BUT, the saving grace is the release schedule...if Magento is able to stay on track, and devotes enough time to each sprint to address these issues (versus just making new features), then we should see some slow and steady progress. That's my hopes anyway...either that or it's PR time lol
    – ryanF
    Jun 13, 2016 at 9:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.