Development

#4170 (Documentation error in Listing 14-29 for admin generator)

You must first sign up to be able to contribute.

Ticket #4170 (closed documentation: fixed)

Opened 4 months ago

Last modified 4 months ago

Documentation error in Listing 14-29 for admin generator

Reported by: alexf Assigned to: fabien
Priority: minor Milestone:
Component: generator Version: 1.1.0
Keywords: Cc:
Qualification: Unreviewed

Description

If one tries to override a module action using the example in Listing 14-29, a PHP error is generated: PHP Fatal error: Call to a member function getParameter() on a non-object

This non-object refers to the parameter "$request" which happens to be uninitialized.

To find the correct way of handling this I looked at one of the admin generated actions. So to follow the way the admin generator works, listing 14-29 should probably read as follows:

class userActions extends autouserActions
{
  protected function updateUserFromRequest()
  {
    // Handle the input of the partial field
    $user = $this->getRequestParameter('user');
 
    if (isset($user['newpassword']))
    {
      $this->user->setPassword($user['newpassword']);
    }
 
    // Let symfony handle the other fields
    parent::updateUserFromRequest();
  }
}

Change History

08/13/08 14:10:07 changed by fabien

  • status changed from new to closed.
  • resolution set to fixed.

(In [10837]) [doc] [1.1, 1.2] fixed typo (closes #4170)