I am creating a web application that stores user's journeys and I'm build
this application in CakePHP 2.2.5.
I have a Journey model and that journey model has many coordinate objects
which store the lat long coordinates.
I want to create a REST API to create journeys that accepts JSON in the
body which will contain information detailing the journey as well as
detailing coordinates, to create the coordinates objects that should be
attached to the journey object all in one controller method.
I'm not sure where to start.
Here is the code for the add function in the journeys controller
public function add() {
if ($this->request->is('post')) {
$this->Journey->create();
if ($this->Journey->save($this->request->data)) {
$this->Session->setFlash(__('The journey has been saved'));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The journey could not be saved.
Please, try again.'));
}
}
$users = $this->Journey->User->find('list');
$this->set(compact('users'));}
Any help would be appreciated.
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.