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

Remove the unused Ajax/Serializer.php class #8405

Merged
merged 3 commits into from
Feb 9, 2017

Conversation

dmanners
Copy link
Contributor

@dmanners dmanners commented Feb 3, 2017

Since this class is not used anywhere can we remove it as it is using Zend1 Json which is at end of life.

@ishakhsuvarov ishakhsuvarov self-assigned this Feb 3, 2017
@ishakhsuvarov
Copy link
Contributor

@dmanners Sadly, we can not remove a class, since theoretically there might be an extension or customization which already relies on it in any possible way.

@dmanners
Copy link
Contributor Author

dmanners commented Feb 3, 2017

@ishakhsuvarov fully get that you cannot remove an unused class in a minor release. So in this example of an unused class what is the path to removal? Deprecate and remove in future major release?

@ishakhsuvarov
Copy link
Contributor

@dmanners Currently our strategy on this case is to mark class as well as all of it's methods as deprecated.

@dmanners
Copy link
Contributor Author

dmanners commented Feb 3, 2017

Cool @ishakhsuvarov then I will do that and replace Zend_Json while I am at it.

@dmanners
Copy link
Contributor Author

dmanners commented Feb 3, 2017

so @ishakhsuvarov I have added the deprecated noticed but I was also considering if we should call trigger_error('Deprecated method getProductsJSON called', E_USER_DEPRECATED) or something similar. This does have down sides that with the wrong php.ini settings it could flow the log files.

Any thoughts on that?

@@ -5,9 +5,31 @@
*/
namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Ajax;

use Magento\Framework\View\Element\Template;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding @deprecated annotation for class as well.
Also, a comment with motivation for deprecation is a really good thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure can do.

@ishakhsuvarov
Copy link
Contributor

@dmanners Currently the only thing we do is add annotations.

@dmanners
Copy link
Contributor Author

dmanners commented Feb 3, 2017

@ishakhsuvarov I am still not sure what the best way to deal with deprecation is. Luckily in my day to day job I don't have to worry about people trusting my functions in that way as it is only me and my direct team working on them. I know symfony have some tools to help people like http://symfony.com/blog/paving-the-way-for-symfony-3-with-the-deprecation-detector-tool and I think they log deprecated calls also but I am not 100% about that currently.

@ishakhsuvarov
Copy link
Contributor

@dmanners
Sorry for taking so long to complete work on this.
I've just requested some more changes in the code review. After that I can proceed with the merge.
Thank you.

array $data = []
) {
parent::__construct($context, $data);
$this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Please use Magento\Framework\Serialize\Serializer\Json instead of SerializerInterface.
  • Since you are creating a new constructor, but not modify the existing one – you may use regular dependency injection technique.

@mmansoor-magento mmansoor-magento merged commit 4135880 into magento:develop Feb 9, 2017
@okorshenko
Copy link
Contributor

@dmanners thank you for this PR. It successfully merged to develop branch

@dmanners dmanners deleted the remove-zend-json-catalog branch February 10, 2017 11:26
@okorshenko okorshenko added this to the February 2017 milestone Feb 11, 2017
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.

None yet

5 participants