Convert this page callback to a new-style Form object, using the instructions on http://drupal.org/node/1800686

Files: 
CommentFileSizeAuthor
#26 user-1984610-26.patch10.11 KBtim.plunkett
PASSED: [[SimpleTest]]: [MySQL] 57,889 pass(es).
[ View ]
#20 drupal-1984610-20.patch10.52 KBdawehner
FAILED: [[SimpleTest]]: [MySQL] 56,946 pass(es), 2 fail(s), and 0 exception(s).
[ View ]
#20 interdiff.txt5.74 KBdawehner
#16 1984610-user_pass_conversion-16.patch7.43 KBAlbert Volkman
FAILED: [[SimpleTest]]: [MySQL] 55,582 pass(es), 1 fail(s), and 0 exception(s).
[ View ]
#15 1984610-user_pass_conversion-15.patch0 bytesAlbert Volkman
PASSED: [[SimpleTest]]: [MySQL] 55,849 pass(es).
[ View ]
#13 1984610-user_pass_conversion-13.patch7.44 KBAlbert Volkman
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1984610-user_pass_conversion-13.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#13 interdiff.txt697 bytesAlbert Volkman
#11 1984610-user_pass_conversion-11.patch7.43 KBAlbert Volkman
FAILED: [[SimpleTest]]: [MySQL] 55,796 pass(es), 27 fail(s), and 27 exception(s).
[ View ]
#11 interdiff.txt7.54 KBAlbert Volkman
#8 1984610-user_pass_conversion-8.patch4.49 KBAlbert Volkman
FAILED: [[SimpleTest]]: [MySQL] 55,342 pass(es), 28 fail(s), and 19 exception(s).
[ View ]
#6 1984610-user_pass_conversion-6.patch4.52 KBAlbert Volkman
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1984610-user_pass_conversion-6.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#6 interdiff.txt1.59 KBAlbert Volkman
#2 1984610-user_pass_conversion-1.patch4.64 KBAlbert Volkman
FAILED: [[SimpleTest]]: [MySQL] 55,395 pass(es), 28 fail(s), and 17 exception(s).
[ View ]

Comments

Tagging

StatusFileSize
new4.64 KB
FAILED: [[SimpleTest]]: [MySQL] 55,395 pass(es), 28 fail(s), and 17 exception(s).
[ View ]

This is my first conversion, please be gentle :) I haven't converted the validate or submit functions yet.

Status:Active» Needs review

Status:Needs review» Needs work

The last submitted patch, 1984610-user_pass_conversion-1.patch, failed testing.

Thanks for helping on all that conversion issues.

+++ b/core/modules/user/lib/Drupal/user/UserPasswordController.phpundefined
@@ -0,0 +1,66 @@
+ * Definition of Drupal\user\UserPasswordController.

The current standard for @file is "Contains \...". just have a look at http://drupal.org/node/1354 for general informationl.

+++ b/core/modules/user/lib/Drupal/user/UserPasswordController.phpundefined
@@ -0,0 +1,66 @@
+use Drupal\Core\Entity\EntityFormController;
...
+class UserPasswordController extends EntityFormController {

he, this controller is another controller :) Just extend no class by default. This works as well.

+++ b/core/modules/user/lib/Drupal/user/UserPasswordController.phpundefined
@@ -0,0 +1,66 @@
+  /**

all that nitpicking is just to make it as perfect as possible. ... there should be an empty line after the first {

+++ b/core/modules/user/lib/Drupal/user/UserPasswordController.phpundefined
@@ -0,0 +1,66 @@
+   * {@inheritdoc}
+   */
+  public static function create(ContainerInterface $container) {
+    return new static();
+  }
+
+  /**
+   * Constructs a PasswordController object.
+   */
+  public function __construct() {

If you have nothing injected into the class, there is no reason to put that code here.

+++ b/core/modules/user/lib/Drupal/user/UserPasswordController.phpundefined
@@ -0,0 +1,66 @@
+  public function passwordUser(Request $request) {

This method should be documented. In general: It's really great that you can just get the request object very easy here.

+++ b/core/modules/user/lib/Drupal/user/UserPasswordController.phpundefined
@@ -0,0 +1,66 @@
+  ¶
...
+  ¶

empty spaces.

+++ b/core/modules/user/user.routing.ymlundefined
@@ -25,3 +25,10 @@ user_account_settings:
+    _controller: '\Drupal\user\UserPasswordController::passwordUser'

Just wondering whether it makes more sense in a general UserController.

Feel free to ping me on IRC if you need help with fixing this failures.

Status:Needs work» Needs review
StatusFileSize
new1.59 KB
new4.52 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1984610-user_pass_conversion-6.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Second try.

Status:Needs review» Needs work

The last submitted patch, 1984610-user_pass_conversion-6.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new4.49 KB
FAILED: [[SimpleTest]]: [MySQL] 55,342 pass(es), 28 fail(s), and 19 exception(s).
[ View ]

Erm, let's try that again.

Status:Needs review» Needs work

The last submitted patch, 1984610-user_pass_conversion-8.patch, failed testing.

This looks great so far, beside of the failing tests ^^

+++ b/core/modules/user/lib/Drupal/user/UserPasswordController.phpundefined
@@ -0,0 +1,62 @@
+  /**
+   * {@inheritdoc}
+   */
+  public static function create(ContainerInterface $container) {
+    return new static();

If you don't implement the ControllerInterface you also don't need the create method.

+++ b/core/modules/user/lib/Drupal/user/UserPasswordController.phpundefined
@@ -0,0 +1,62 @@
+   * @param Request $request

We use the full namespace on documentation.

Status:Needs work» Needs review
StatusFileSize
new7.54 KB
new7.43 KB
FAILED: [[SimpleTest]]: [MySQL] 55,796 pass(es), 27 fail(s), and 27 exception(s).
[ View ]

Since this is returning a form, I think I was approaching this incorrectly. Consider this take 2 :)

Status:Needs review» Needs work

The last submitted patch, 1984610-user_pass_conversion-11.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new697 bytes
new7.44 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1984610-user_pass_conversion-13.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Added the Request object \Drupal::request(). Although, I'm assuming that's a hard dependency which shouldn't be added that way.

Status:Needs review» Needs work

The last submitted patch, 1984610-user_pass_conversion-13.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new0 bytes
PASSED: [[SimpleTest]]: [MySQL] 55,849 pass(es).
[ View ]

Re-roll.

StatusFileSize
new7.43 KB
FAILED: [[SimpleTest]]: [MySQL] 55,582 pass(es), 1 fail(s), and 0 exception(s).
[ View ]

Argh.

Status:Needs review» Needs work

The last submitted patch, 1984610-user_pass_conversion-16.patch, failed testing.

+++ b/core/modules/user/lib/Drupal/user/UserPasswordForm.phpundefined
@@ -0,0 +1,102 @@
+   * Implements \Drupal\Core\Form\FormInterface::buildForm().

You could implement {@inheritdoc} ... and nothing else, because this is partially incorrect.

+++ b/core/modules/user/lib/Drupal/user/UserPasswordForm.phpundefined
@@ -0,0 +1,102 @@
+      $form['name']['#default_value'] = \Drupal::request()->query->get('name');

Have you tried to inject the request into the form?

+++ b/core/modules/user/lib/Drupal/user/UserPasswordForm.phpundefined
@@ -0,0 +1,102 @@
+   * Implements \Drupal\Core\Form\FormInterface::validateForm().
...
+   * Implements \Drupal\Core\Form\FormInterface::submitForm().

{@inheritdoc}

+++ b/core/modules/user/lib/Drupal/user/UserPasswordForm.phpundefined
@@ -0,0 +1,102 @@
+    $users = entity_load_multiple_by_properties('user', array('mail' => $name, 'status' => '1'));
...
+      $users = entity_load_multiple_by_properties('user', array('name' => $name, 'status' => '1'));

What about injecting the user storage controller as well?

Assigned:Unassigned» dawehner

Assigning to myself to inject the request into the form controller method.

Assigned:dawehner» Unassigned
Status:Needs work» Needs review
StatusFileSize
new5.74 KB
new10.52 KB
FAILED: [[SimpleTest]]: [MySQL] 56,946 pass(es), 2 fail(s), and 0 exception(s).
[ View ]

I think the proper way would be to use the controller resolver to pass in values instead of using custom reflection code.

Sadly this requires some hacks, but maybe we could get this fixed by extend our controller resolver.

+++ b/core/lib/Drupal/Core/Controller/HtmlFormController.phpundefined
@@ -80,7 +81,7 @@ public function content(Request $request, $_form) {
-      if (in_array('Drupal\Core\ControllerInterface', class_implements($form_arg))) {
+      if (in_array('Drupal\Core\Controller\ControllerInterface', class_implements($form_arg))) {

i cant believe how this forgotten piece havent bite us yet?

Besides the hacks, that i am not sure i can think of a better alternative, this should maybe _entity_form like i said to dawehner in irc

Status:Needs review» Needs work

The last submitted patch, drupal-1984610-20.patch, failed testing.

Added an issue to remove ControllerInterface: #1998140: Remove backward compatible ControllerInterface

There is a BC-Interface for that ...

Status:Needs work» Postponed

ah..now i found out that crell kept a bc interface, so no conversions break during that
postponing this issue per #24

Status:Postponed» Needs review
StatusFileSize
new10.11 KB
PASSED: [[SimpleTest]]: [MySQL] 57,889 pass(es).
[ View ]

Was too out of date for an interdiff.

Status:Needs review» Reviewed & tested by the community

Perfect!

Status:Reviewed & tested by the community» Fixed

Committed to 8.x. Thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.