Introduction
This test application is made to present the usage of CpAmf plugin for cakePHP 1.2. The example is based on test application for cakeAMF plugin:
https://trac.cakefoundation.org/amf/wiki/tutorial/amf
Thanks to developer(s) of cakeAMF plugin.
Requirements
- CakePHP 1.2
- CpAmf plugin (included in package)
Introduction
The example is a very basic "user management" application. You can list all users, get a user by id, and insert new user to the database. Use it with the flex example application.
Installation
Just copy the cpamf_test folder to your web server's htdocs directory. To check the gateway installation, simply open the following url:
localhost/cpamf_test/cpamf/gateway.
You should see a message like this:
amfphp and this gateway are installed correctly.
You may now connect to this gateway from Flash.
If you have the amf extension you shuld see this in message:
AMF C Extension is loaded and enabled.
Create a mysql database. Set up connection parameters in config/database.php file. The sql file for the users table is included in this package (cpamf.sql).
Using the service browser
The service browser is accessible at following url:
localhost/cpamf_test/cpamf/browser.
NOTE: In this test application you can use the UsersController class, and the following methods:
- getUser
- getAllUsers
- insertUser
- test
Download
Download the example here.
See also
CpAmf flex example.
Benjamin Müller
hej, thank you for this great plugin description. Unfortunately, when I tried to create an app on my own, it does not work. I used bake to create a project and bake all to insert models and controllers. Then I installed the plugin and my cpamf/browser works so far, BUT if I click on one of the Controller on the left side there is a failure message "Service does not contain any methods". But there are some methods ( eg auto generated ones). Ideas?
thank you, benny
web 2.0 development company
thanks for sharing information & having really informative . .
Daniel Verner
@Benjamin Müller
Check the method prefix in /cpamf/vendors/amfphp/globals.php ( define( "METHOD_PREFIX", "prefix" );). If it is set, then the service browser only shows methods beginning with this prefix. If you want to see all methods set this const to empty string.
You shold use the latest version of the cpamf plugin(v0.12)
Roel
Hi,
Thanks for the great plugin. I had the same problem as Benjamin. After some research I managed to fix it (as far I can see). It came down to this:
In 'discovery_service_controller.php' (line 89) use Inflector::underscore on $classname. Then in 'CakeMethodTable.php' (line 42, 46) remove Inflector::underscore. This way it won't be applied on the whole path. At last I added the suffix 'Controller' on line 50. This way the right class will be found in with MethodTable::getClassMethodsReflection() ()
Roel
Uhm.. ignore that last edit. Adding the suffix was a mistake.
Itziar
Hi,
Thanks for the information. But I have an error with the service browser.
When I access to the following url http://localhost/cpamf_test/cpamf/browser I get this error.
(mx.rpc::Fault)#0
errorID = 0
faultCode = "Client.Error.MessageSend"
faultDetail = "Channel.Connect.Failed error NetConnection.Call.BadVersion: "
faultString = "Send failed"
message = "faultCode:Client.Error.MessageSend faultString:'Send failed' faultDetail:'Channel.Connect.Failed error NetConnection.Call.BadVersion: '"
name = "Error"
rootCause = (Object)#1
code = "NetConnection.Call.BadVersion"
description = ""
details = ""
level = "error"
what the problem might be?
Thank
Itziar
Rajib Ahmed
I was trying to work with this plugin for three days. The first problem that Bugged me for a while that in cakeMethodTable.php in create method that generated bullshit path through camelize ie CakeAMF ... becomes c_a_m_f directory that not cool. then i am using php5.3.1 so eregi_replace function on MethodTable.php doesn't work have to rewrite 2 line as
// $comment = eregi_replace("\n[ \t]+", "\n", trim($comment));
--to--
$comment =preg_replace("/\n[ \t]+/", "\n", trim($comment));
//$comment = eregi_replace("[\t ]+", " ", trim($comment));
--to--
$comment = preg_replace("/[\t ]+/", " ", trim($comment));
then the demo works fine which is built on top of cpamf 0.9
if you need any help go to my site then post a comment .. I ll try to reply
Paul Man
This plugin is not working with cakePHP 1.4 RC4
Missing Controller
Error: GatewayController could not be found.
Error: Create the class GatewayController below in file: app\controllers\gateway_controller.php
help please!!