-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix getMetadataFor detection #4083
Conversation
} | ||
} | ||
|
||
// TODO: remove method check in next major release |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please replace TODO
with NEXT_MAJOR
(we will grep
for that before releasing)
@greg0ire when i remember correctly, we have an issue or an open PR which tried to fix this, but which did not work as expected... 💭 |
Yes, this looks oddly familiar… |
} | ||
} | ||
|
||
// NEXT_MAJOR: remove method check in next major release |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we do this we should trigger a deprecation here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No; it is not part of the user land; it is just a command to dump information.
Here is the history, brought to you by commit 3e7ad359411a5f4ae119d9dc3ef26b3e44716fd1
Author: Thomas Rabaix <thomas.rabaix@gmail.com>
Date: Mon Nov 23 19:00:57 2015 +0100
Add support for SF3.0 (WIP)
diff --git a/Command/ExplainAdminCommand.php b/Command/ExplainAdminCommand.php
index 11cfca1..e35235e 100644
--- a/Command/ExplainAdminCommand.php
+++ b/Command/ExplainAdminCommand.php
@@ -89,16 +89,14 @@ public function execute(InputInterface $input, OutputInterface $output)
$output->writeln(sprintf(' - % -25s % -15s % -15s', $name, $fieldDescription->getType(), $fieldDescription->getTemplate()));
}
- $validator = $this->getContainer()->get('validator');
- // TODO: Remove conditional method when bumping requirements to SF 2.5+
- if (method_exists($validator, 'getMetadataFor')) {
- $metadata = $validator->getMetadataFor($admin->getClass());
+ if ($this->getContainer()->has('validator.validator_factory')) {
+ $metadata = $this->getContainer()->get('validator.validator_factory')->getMetadataFor($admin->getClass());
} else {
- $metadata = $validator->getMetadataFactory()->getMetadataFor($admin->getClass());
+ $metadata = $this->getContainer()->get('validator')->getMetadataFor($admin->getClass());
}
$output->writeln('');
- $output->writeln('<comment>Validation Framework</comment> - http://symfony.com/doc/2.0/book/validation.html');
+ $output->writeln('<comment>Validation Framework</comment> - http://symfony.com/doc/3.0/book/validation.html');
$output->writeln('<info>Properties constraints</info>');
if (count($metadata->properties) == 0) {
commit baf9d425f67486bc1ca6612fa15adf703a8d1e64
Author: Sullivan SENECHAL <soullivaneuh@gmail.com>
Date: Fri May 1 12:21:44 2015 +0200
Fix deprecated getMetadataFactory method usage
diff --git a/Command/ExplainAdminCommand.php b/Command/ExplainAdminCommand.php
index 08800f8..19bd482 100644
--- a/Command/ExplainAdminCommand.php
+++ b/Command/ExplainAdminCommand.php
@@ -90,8 +90,13 @@ public function execute(InputInterface $input, OutputInterface $output)
$output->writeln(sprintf(' - % -25s % -15s % -15s', $name, $fieldDescription->getType(), $fieldDescription->getTemplate()));
}
- $validatorFactory = $this->getContainer()->get('validator')->getMetadataFactory();
- $metadata = $validatorFactory->getMetadataFor($admin->getClass());
+ $validator = $this->getContainer()->get('validator');
+ // TODO: Remove conditional method when bumping requirements to SF 2.5+
+ if (method_exists($validator, 'getMetadataFor')) {
+ $metadata = $validator->getMetadataFor($admin->getClass());
+ } else {
+ $metadata = $validator->getMetadataFactory()->getMetadataFor($admin->getClass());
+ }
$output->writeln('');
$output->writeln('<comment>Validation Framework</comment> - http://symfony.com/doc/2.0/book/validation.html');
commit 1394100cd8d19aacbde1c70a2e2e529523920f57
Author: Thomas Rabaix <thomas.rabaix@sonata-project.org>
Date: Fri Jun 7 22:52:49 2013 +0200
Fix deprecated call
diff --git a/Command/ExplainAdminCommand.php b/Command/ExplainAdminCommand.php
index 6d310b4..c2bbac4 100644
--- a/Command/ExplainAdminCommand.php
+++ b/Command/ExplainAdminCommand.php
@@ -87,7 +87,7 @@ public function execute(InputInterface $input, OutputInterface $output)
}
$validatorFactory = $this->getContainer()->get('validator.mapping.class_metadata_factory');
- $metadata = $validatorFactory->getClassMetadata($admin->getClass());
+ $metadata = $validatorFactory->getMetadataFor($admin->getClass());
$output->writeln('');
$output->writeln('<comment>Validation Framework</comment> - http://symfony.com/doc/2.0/book/validation.html'); |
Related : #4045 |
All green can we merge ? |
LGTM |
@OskarStark @soullivaneuh can we merge this PR ? |
@sonata-project/contributors , final review and merge? |
LGTM |
Thanks @rande |
I am targetting this branch, because it is the stable one
Changelog
Subject
Fix how metadata information are retrieved when admin information are dumped