Welcome Guest, Not a member yet? Register   Sign In
Segment/passing to method problem
#2

[eluser]bretticus[/eluser]
Do not assume that the parameter will be an array by default. Especially if it's optional. Do the type checking within the method (to tell you the truth I cannot think of one use case where an array needs to be passed from a controller method since the controller is "hooked" via the URL. Why call controller methods internally? Perhaps you can enlighten me.)

Code:
function index($additionalData = null) {
if is_array($additionalData) {
  // handle extra params.
}
}


Messages In This Thread
Segment/passing to method problem - by El Forum - 08-05-2009, 11:19 AM
Segment/passing to method problem - by El Forum - 08-05-2009, 01:03 PM
Segment/passing to method problem - by El Forum - 08-05-2009, 01:32 PM
Segment/passing to method problem - by El Forum - 08-05-2009, 01:47 PM
Segment/passing to method problem - by El Forum - 08-05-2009, 01:59 PM
Segment/passing to method problem - by El Forum - 08-05-2009, 07:48 PM



Theme © iAndrew 2016 - Forum software by © MyBB