Understanding how Yii PHP Framework works Am I right?

I recently have been trying to learn Yii and PHP together.
I have hit a road block in my understanding. I see it works on the Trackstar example code from
"Agile Web Application Development with Yii 1.1 and PHP5"

I can not understand how an action like
<form id="project-form" action="/trackstar/index.php?r=project/create" method="post">
      <p class="note">Fields with <span class="required">*</span> are required.</p>
 as the HTML rendered looks like the above

triggers a record creation. Could someone explain the program flow?
project is the projectController.php  and create is the view involved but how does the actual
SQL command  Insert   .. $model data ... get executed?
Is the create view essential for the name? Do I have to override whatever other view name I use? Someone help  me out here????
Does this happen via get and Post?? e.g after post then the data is saved
via the if(isset($_POST['Project']))
May be I am right here has it been there the whole time.
1. call up url from menu or type into browser:  to render the form as a get
e.g http://localhost/trackstar/index.php?r=project/create 
press the submit button and go to the same URL but as a  post -
call save funcion code within the parent of the model, CActivateRecord

Here is the actionCreate function:
      public function actionCreate()
            $model=new Project;

            // Uncomment the following line if AJAX validation is needed
            // $this->performAjaxValidation($model);

            fwrite($fp0," Got 2 start of actionCreate");

            fwrite($fp1," We Got POST SO WE ARE INSERTING DATA");

            $this->render('create',array( 'model'=>$model,));
            fwrite($fp," Got here to end");

In fact it makes sense that the parent class CActiveRecord of the model here contains the
save function which actually saves the data base record.
Can anyone comment on this finding? Maybe this will help others like myself
Robert SilverSr. Software EngineerAsked:
Who is Participating?
Ray PaseurConnect With a Mentor Commented:
get method displaying a form or view page and post to process the results of said view page

That is, indeed, "a classic fashion."  In fact it is a little bit more than classic.  If you make a Google search for "get vs post" you will find many results, and among them this very good little article.

In a nutshell, GET method requests use the URL to carry the request arguments.  You can send a link to a friend if the page can be retrieved with a GET request (very handy) like this:

GET requests must not modify the underlying data model -- they are just for displaying information.  As the article points out, GET should be used if and only if there are no side effects to the retrieval of data.

POST requests use the request body (a raw post string of arguments) to carry the content of the request.  You can use POST requests when you want to add, update or remove information from the underlying data model.

It's all part of the HTTP specs.
Ray PaseurCommented:
Not sure exactly where to start, and you might want to break this line of inquiry down into several questions, since it seems to be all over the Yii and PHP map.  Perhaps the best response is to provide you some learning resources.

You can make a Google search for "learn Yii Framework" -- I did and found many apparently good learning resources.

If you're not rock-solid in your PHP skills, you might want to learn the basics of PHP through the well-explained examples in these two books.

Frameworks are typically object-oriented, and Yii is no different, so you will need to understand object-oriented PHP programming.  This page and all the linked pages will give you something of a flavor for that.

And this book will help add some foundation to your understanding of OOP.

Some additional interesting information is available here:

Robert SilverSr. Software EngineerAuthor Commented:
While your reply is somewhat helpful I was looking for confirmation of my understanding whcih recent progress has vindicated.
 Today I  have more questions. Since no else has come forward and actually
validated statements I know to be true I will sum it up as this.
My understanding was dead on.  You get the  view or form and post the results typically in the yii framework standard.   You pass a model and run your view from the controller like most MVC frameworks.  The post of the form data back to the controller is handled through the action url of the form  View used to populate typically a database.

Proof of work helps! For all those other people interested.'
Ray PaseurCommented:
Sorry, I did not understand that the question was about post of the form data back to the controller is handled through the action url of the form.  Please let me add this link to the collected learning resources above.

HTH, ~Ray
Robert SilverSr. Software EngineerAuthor Commented:
As I said before. I assumption was in fact correct The demo TrackStar application in fact uses the
get method displaying a form or view page and  Post to process the results of said view page.
I think it will be helpful for others struggling to understand Yii Framework and how it gets implemented in a classic fashion e.g Trackstar demo.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.