Hello, I've been stuck on this for a few days and search up and down for this on the net, no response I've found has worked, so I come to you...
Here are the steps I've taken, I think it's pretty standard
1. I have a macbook pro running osx 10.7.3
2. I installed MAMP all default (I've acually reinstalled this because someone suggested this might fix it)
3. Thru phpMyAdmin I created a database called my_test
4. In that database I created a table, this is the export of that table: (I've also tried this with InnoDB which is the default)
CREATE TABLE `customer` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`email` varchar(150) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
5. I created a new Flx Project (Running Flash Builder 4.5.1 Premium)
Project Name: PHPTest
Application Type: Desktop (Although I've done the same thing with Web and got the same results)
Application Server Type: PHP
Web Root: /Applications/MAMP/htdocs/
URL Root: http://localhost:8888/
Clicked 'Validate Configuration' and that worked
Output Folder: /Applications/MAMP/htdocs/PHPService (default by Flash Builder)
6. On the Data/Services tab on the bottom I click 'Connect to Data/Service...'
Select 'Click here to generate a sample'
Select 'Generate from database' radio button
Password: root (default for MAMP)
Host name: localhost
Server port: 8889 (default for MAMP MySQL port, the HTTP port default is 8888 which in both cases seem to work but every video I've seen that uses MAMP on youtube uses 8889)
Click 'Test Connection' (works)
Primary Key: id (this field is greyed out and Flash Builder selects 'id' which it figures out from the SQL table)
>> Click OK
7. Then if I don't have the Zend Framework folder in my /Applications/MAMP/htdocs/ folder it tells me its going to create that and I say alright. Then Flash Builder says stuff about how this is really only for testing and not production server ready and I say alright.
8. Then it takes me back to the Form from Step 6 when I get the chance to select 'Click here to generate a sample'
These fields are now filled with this data automaticly:
PHP Class: /Applications/MAMP/htdocs/PHPTest/services/CustomerService.php
Service name: CustomerService
Service package: services.customerservice
Data type package: valueObjects
>> Click Next (shows all the functions that will be now availible)
>> Click Finished (End of the forms and it opens Dreamweaver to the php file it created CustomerService.php which I have no need to edit so I close that down)
9. Back in Flash Builder I switch to design view and drag a datagrid onto the big white area in the middle, whatever that is called.
10. Then below in Data/Services tab on the bottom I click drag the function 'GetAllCustomer' on top of the datagrid.
I say yes to rebound and click ok and the view of the datagrid is updated with the colums from the 'customer' table in mySQL.
(Now let me say that when I hit save and compile this, if I actually had records in this table that I insert thru phpMyAdmin, this does show in the datagrid. So for the whole CRUD thing I am able to get the R which is Read)
11. Now going back to the design view in Flash Builder I will create a form to create records in the table... (I guess this isn't really a step)
12. In the Data/Service tab on the bottom I select 'createCustomer' function and then there is an icon called 'Generate Form' that looks like a white piece of paper with a gear on the bottom of it.
13. This opens up a new form and since I don't have a crazy bunch of fields in my table I just click Finished (If you click next you can specify which fields you want to exclude from the form but this time I don't need to)
14. This actually creates 2 forms if you look at the code, the second just shows the return type from when you click 'CreateCustomer' button on the first form. Because they overlap in design view I drag the form out of the way so you can see the input form, the return form, and the datagrid
15. Then I save and compile...
(Also if your actually reading this I didn't remove the id form field, I get the same result either way, but if you do remove the form field in the code/design you also have to update the button function to not deal with the id before it gets sent off to the php page since in this case the MySQL table is set to auto_increment the id, sorry this doesn't make much sence but this little area doesn't matter much either way)
16. Now fill in whatever data you want for name and email, try differnt numbers in the id field like 0, nothing, 1, 1000 and click 'CreateCustomer'
(For me nothing happens, no return is put in the return field, no error pops up and the datagrid is not updated with the new record, also going over to phpMyAdmin and checking out the table browse doesn't show any changes either, I know the button is calling the function because if I add a state change in that function it changes, it would seem that the line:
createCustomerResult.token = customerService.createCustomer(customer2); doesn't do anything)
So any idea what is wrong here, I'm convenced it's something stupid easy simple I just can't see it.