John Smith
John Smith

Reputation: 8811

Creating a new action

I've inherited a symfony project and I'm trying to create a new action.

I've gone to the /frontend/modules/theModuleName/actions/actions.class.php file and created a new function (there are already several in there) and followed the naming guideline of calling it executeFunctionName.

However, when I try to call it from a template like so:

<form action="/frontend_dev.php/theModuleName/functionName" method="post"> I just get errors and it doesn't work.

What else needs to be done to create a new action?

Upvotes: 1

Views: 860

Answers (1)

Vlad Jula-Nedelcu
Vlad Jula-Nedelcu

Reputation: 1696

I assume by errors you mean 404 (not found). That only works if you still have the default routing rules:

default_index:
  url:   /:module
  param: { action: index }

default:
  url:   /:module/:action/*

Otherwise just make a rule. something like this:

my_route:
  url: /my-custom-url.html
  param: { module: theModuleName, action: functionName }

Upvotes: 2

Related Questions