This object is used for demonstration purposes of RPC with Flex.

In Flex I will connect to this object via the default AMFChannel. An example of setting up the Channel is available on this website.

Make sure you check (expand the method) token_call and insert_date for additional tags that I have used.

package RPC
author Brent Knigge
copyright 20 January 2013
version 1
link View the contents of this file.
TODO tidy up the code a bit more, and add some private / protected methods for demonstration.

 Methods

short description is written here

__construct() : void

An extended longer version is written here. It is shown when you click on the thingy...

get_all_records

get_all_records() : array

Returns all the records in the table.

Returns

arrayof DataLine

get_date

get_date() : \VO\DataLine

This method demonstrates how to create a Date in PHP and pass it to Flex using AMFphp

Returns

\VO\DataLine

get_random_record

get_random_record() : \DataLine

Returns a random record.

Returns

get_record_at

get_record_at(int $p_index_id) : \DataLine

Returns a record based on the primary key that is passed in. If no entry exists, then an empty object is returned.

Parameters

$p_index_id

int

primary key of the record you wish to retrieve

Returns

insert_date

insert_date(\DataLine $p_data) : void

A sample method that has been written to test inserting a date into a MySQL database from Flex. Make sure you check out the valid string formats for creating Flex Dates.

var trial : DataLineFlex = new DataLineFlex();
trial.some_char = 'trial of AMFPHP';
trial.some_int  = 9;
trial.some_date = new Date("Wed Apr 25 2012 4:00:00 PM");

Bravo.insert_date(trial);

Parameters

$p_data

\DataLine

object containing the data to be inserted into the table

insert_record

insert_record(\DataLine $p_data) : array

Inserts a DataLine object into Table1

Parameters

$p_data

\DataLine

Returns

arrayof DataLine

token_call

token_call(string $p_letter) : string

A method that has been designed to test the ASyncToken class from Flex.

  • First call takes 10 seconds
  • Second call takes 5 seconds
  • Third call takes 15 seconds.

When the button is hit in rapid succession, ABC is passed to PHP. BAC is returned to Flex based on the time delay.

Parameters

$p_letter

string

a letter of either A, B or C

Returns

stringa simple statement is returned.

 Properties

 

database connection

$dbc : resource