Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve fatal error in repository generator #10601

Merged
merged 3 commits into from
Aug 22, 2017

Conversation

AntonEvers
Copy link
Contributor

@AntonEvers AntonEvers commented Aug 21, 2017

Description

Both InputException and NoSuchEntityException require a Phrase object as first constructor argument
PHP Fatal error: Uncaught TypeError: Argument 1 passed to Magento\\Framework\\Exception\\InputException::__construct() must be an instance of Magento\\Framework\\Phrase, string given

Fixed Issues (if relevant)

  1. Can't delete last item in cart if Minimum Order is Enable  #6151

Manual testing scenarios

  1. auto-generate a repository
  2. call the get method without a parameter

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

Anton Evers and others added 3 commits August 21, 2017 17:15
Both InputException and NoSuchEntityException require a Phrase object as first constructor argument
`PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Magento\\Framework\\Exception\\InputException::__construct() must be an instance of Magento\\Framework\\Phrase, string given`
@ishakhsuvarov
Copy link
Contributor

@ajpevers Thanks for this PR. We are currently working on deprecating repository generation feature and materialization of all existing auto-generated repositories, so please do not rely heavily on this approach

@ishakhsuvarov ishakhsuvarov added this to the August 2017 milestone Aug 21, 2017
@ishakhsuvarov ishakhsuvarov self-assigned this Aug 21, 2017
@AntonEvers
Copy link
Contributor Author

@ishakhsuvarov ooh, good that you mention it. In that case I won't use it in my own code.

@AntonEvers
Copy link
Contributor Author

@ishakhsuvarov do you have a good example of a repository class in the Magento code base? On http://devdocs.magento.com/guides/v2.1/extension-dev-guide/service-contracts/design-patterns.html the interfaces CustomerRepositoryInterface, AddressRepositoryInterface and GroupRepositoryInterface are mentioned as good examples, but 2 of them use the deprecated save() method directly on the entity objects. GroupRepositoryInterface uses a save method on the resource model. Is that the way to go with repositories?

@magento-team magento-team merged commit fb98f66 into magento:develop Aug 22, 2017
magento-team pushed a commit that referenced this pull request Aug 22, 2017
[EngCom] Public Pull Requests
 - MAGETWO-71769: Add missing translations in Customer module #10604
 - MAGETWO-71761: Resolve fatal error in repository generator #10601
 - MAGETWO-71603: Translate order getCreatedAtFormatted() to store locale #10491
@ishakhsuvarov
Copy link
Contributor

@ajpevers Yes, currently this is an applicable way to go, however this may be swapped out for a better way (from the architectural perspective) in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants