0

My app seems to be completely ignoring the PUT action. I have a controller with GET, POST, PUT and DELETE actions using REST. Both PUT and DELETE methods seem to be ignored. Perhaps it's an action and method syntax issue?

Anyway here is some sample code:

public function init()
{
    // Set the method for the display form to PUT
    $this->setMethod('PUT');
    $this->setAction('/article/?update');
}

From Controller:

public function putAction()
{
    echo "putAction";exit();
}

In my .htaccess I also allow from all GET POST PUT DELETE

I'm confused, it's not working. Please can you help, thanks again!

This is the form:

<form articleid="17" articlename="1" articlecontent="1" topicidfk="1" topicid="1" topicname="Sports" method="put" action="/article?update"><dl class="zend_form">
<dt id="articlename-label"><label for="articlename" class="required">Article Name</label></dt>
<dd id="articlename-element">
<input type="text" name="articlename" id="articlename" value="1" /></dd>
<dt id="articlecontent-label"><label for="articlecontent" class="required">Article Content</label></dt>
<dd id="articlecontent-element">
<textarea name="articlecontent" id="articlecontent" rows="4" cols="80">1</textarea></dd>
<dt id="topicidfk-label">&#160;</dt>
<dd id="topicidfk-element">
<select name="topicidfk" id="topicidfk">
    <option value="0" label="Select One">Select One</option>
    <option value="1" label="Sports" selected="selected">Sports</option>
    <option value="2" label="Finance">Finance</option>
</select></dd>
<dt id="submit-label">&#160;</dt><dd id="submit-element">
<input type="submit" name="submit" id="submit" value="Update Article" /></dd></dl></form>   
picotrain
  • 13
  • 4
  • See a lot of these on SO. ZF Trackers lists: http://framework.zend.com/issues/browse/ZF-4024 and http://framework.zend.com/issues/browse/ZF-3940. Perhaps see Mathew's [write up](http://mwop.net/blog/228-Building-RESTful-Services-with-Zend-Framework.html). Assume it works. – ficuscr Oct 23 '12 at 17:11
  • What output or errors do you get? – drew010 Oct 23 '12 at 20:43
  • Nothing really, it goes through the motions and goes back to the index page I point to using the helper. It doesn't do anything, it seems to either interpret it as a GET with the id of the record to be updated being ?update or update depending on what I set the Action as. – picotrain Oct 24 '12 at 07:05
  • It does nothing. I did Zend_Debug::dump($variable, 'Error'); and it returns NULL. It's not a GET it's not a POST, it's nothing... – picotrain Oct 24 '12 at 16:04

1 Answers1

0

This post Examples on Zend_Rest_Controller Unit Testing - seems to have helped although it looks like a bit of hack but I'll take it for now!

Community
  • 1
  • 1
picotrain
  • 13
  • 4