Insert Function in Symfony (How to save data of Form in to symfony)


We Can inset the relevant data sent from the form or any other refrence data like system date, author id from session variable.
First we need to know how to get the content of form in Model class.
The function Signature of Symfony is :
public function executeSaveCms(sfWebRequest $request) {
Here we can get the post or get request in this above function.
Get Request :

/* Here editId is get request which is sent from browser*/

Post Request :
/* Here contentTitle is input fields name form */
The request is assign in intermediate variable;
$content = $request->getPostParameter(‘ContentTitle’);

$c = new TBLCMS();
/* Create object for inserting table content Table name TBLCMS */
/* These below are the column name which set the content for the relevant column name */
/* The ContentDescription is column name which is CONTENT_DESCRIPTION*/
/*Finally we have to set the object to save function it will run the query with above relevent fields */

Share this Story:
  • facebook
  • twitter
  • gplus

Leave a comment

Facebook Comment