MethodTable reference

All of the following tags may be used inside the methodTable array to change AMFPHP's behaviour or add metadata.

Remote access policy tags

These tags will allow or deny remote Flash movies access to your service’s methods.

access

  • Acceptable values: remote|public|private
  • Required: yes

AMFPHP will only allow remoting calls to methods with access set to remote. Public and private methods are not available to Flash. It is good practice to place internal methods in the methodTable, with access set to public or private, as you will be able to see the methods in the service browser and you can use that info for documentation purposes.

roles

  • Acceptable values: a string consisting of role names separated by commas
  • Required: no

Roles are used for authentication. If this field is set, the credentials of the calling movie must meet those defined in roles. See Authentication for details.

instance

  • Acceptable values: a string
  • Required: no

Used for instance management. The method will only be called if the gateway’s instance name matches the one defined in the methodTable. The instance name of the gateway can be set in gateway.php using $gateway->setInstanceName("instance_name") method. This can stop a class from being loaded as a service in the wrong context.

alias

  • Acceptable values: a string
  • Required: no

Alias redirects a call to a method to another method of the name specified, allowing you to specify a different external and internal name for a method; may be useful if you want to use different naming conventions and you want to create two names for the same method (like echo and print, say).

Metadata tags

These tags are used for documentation, by the service browser and by the code generation module. Keeping these tags up-to-date will help you later on when you need to do maintenance work.

description

  • Acceptable values: any string
  • Required: no, but recommended

A brief description of the service

arguments

  • Acceptable values: array of strings, or array of array of strings.
  • Required: yes if using class mapping, otherwise highly recommended

The method’s arguments. In the future, this field may be required for AMFPHP to run your method, hence you should always fill it. There are two formats that can be used for the arguments: either an array of strings, for example:

arguments => array("arg1", "arg2")

Or array of array of strings:

arguments => array(
  "arg1" => array(
    "type" => "boolean",
    "required" => true
   ),
  "arg2" => array(
    "type" => "boolean",
    "required" => false,
    "description" => "Here comes the description of the second argument."
  )
)

The latter syntax has been deprecated, as it was deemed overly verbose. Use @param and the MethodTable class to achieve a similar effect in a much less painful manner.

Return processing tags

These tags modify the way your return value is processed

returns

  • Acceptable values: any string
  • Required: no

Under most circumstances, you won’t need to set the return type of your methods, as AMFPHP auto-negotiates this for you. If you need to send back XML, Date or custom objects to Flash, you will need to set this tag however. See Datatypes for more details.

New in AMFPHP 1.0 is arrayof and structof syntax. You may for example set the return type to “arrayof mysql resultset” . This will bypass a large amount of typing code and will therefore result in faster response.

There are also two new metadata-types, binary and raw which can write to the stream directly. More info is available in the Datatypes section.

pagesize and countMethod

  • Acceptable values: an integer larger than 0
  • Required: no

Sets the pagesize for pageable resultsets and triggers the paging routine. countMethod sets the paging count method. Learn about pageable recordsets here.


amfphp.org | Disclaimer | Conditions of use