Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove abstract keyword from new methods

- Cannot add new abstract methods (BC break); instead, raise exceptions
  if unimplemented.
- Added in missing patch() method.
  • Loading branch information...
commit d5ff5e955f380f2bdcd337d6b5d2bdbb2a88330d 1 parent a20c088
Matthew Weier O'Phinney authored
Showing with 38 additions and 4 deletions.
  1. +38 −4 library/Zend/Mvc/Controller/AbstractRestfulController.php
42 library/Zend/Mvc/Controller/AbstractRestfulController.php
View
@@ -75,12 +75,28 @@
abstract public function get($id);
/**
+ * Return list of resources
+ *
+ * @return mixed
+ */
+ abstract public function getList();
+
+ /**
* Retrieve HEAD metadata for the resource
*
+ * Not marked as abstract, as that would introduce a BC break
+ * (introduced in 2.1.0); instead, raises an exception if not implemented.
+ *
* @param null|mixed $id
* @return mixed
+ * @throws Exception\RuntimeException
*/
- abstract public function head($id = null);
+ public function head($id = null)
+ {
+ throw new Exception\RuntimeException(sprintf(
+ '%s is unimplemented', __METHOD__
+ ));
+ }
/**
* Respond to the OPTIONS method
@@ -88,16 +104,34 @@
* Typically, set the Allow header with allowed HTTP methods, and
* return the response.
*
+ * Not marked as abstract, as that would introduce a BC break
+ * (introduced in 2.1.0); instead, raises an exception if not implemented.
+ *
* @return mixed
+ * @throws Exception\RuntimeException
*/
- abstract public function options();
+ public function options()
+ {
+ throw new Exception\RuntimeException(sprintf(
+ '%s is unimplemented', __METHOD__
+ ));
+ }
/**
- * Return list of resources
+ * Respond to the PATCH method
+ *
+ * Not marked as abstract, as that would introduce a BC break
+ * (introduced in 2.1.0); instead, raises an exception if not implemented.
*
* @return mixed
+ * @throws Exception\RuntimeException
*/
- abstract public function getList();
+ public function patch($id, $data)
+ {
+ throw new Exception\RuntimeException(sprintf(
+ '%s is unimplemented', __METHOD__
+ ));
+ }
/**
* Update an existing resource
Please sign in to comment.
Something went wrong with that request. Please try again.