Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8122283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T05:47:14+00:00 2026-06-06T05:47:14+00:00

What is the relation or difference between ActiveRecord and model in YII ? i

  • 0

What is the relation or difference between ActiveRecord and model in YII ?

i was trying to log is_object(CActiveRecord::model('Project')); and was expecting false but it returned true;

Since the logging indicated that it’s an object, i thought it is representing a row in the table, but i couldn’t find any attributes that represent the coloumns.

Also http://www.yiiframework.com/doc/api/1.1/CActiveRecord#model-detail states that it’s returning an instance of CActiveRecord class , but i could not find any values of the table row in that object.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T05:47:15+00:00Added an answer on June 6, 2026 at 5:47 am

    The answer is in your documentation link, model() is a class level method, and it:

    Returns the static model of the specified AR class. The model returned is a static instance of the AR class. It is provided for invoking class-level methods (something similar to static class methods.)

    Let’s say you do: $model=CActiveRecord::model('Project'); , then using that $model you can call all the class level methods of CActiveRecord, like:

    $allModels = $model->findAll(); // will give you all the models of Project
    $someModel = $model->findByPk('pkValue'); // will give you the row with primary key value = pkValue 
    $model->deleteAll(); // will delete all the records of Project
    // and so on
    

    Edit:

    Also this post in the forum says: (Difference between class level and static methods)

    Class Level Methods are effectively Static Methods BUT with the benefit of being able to use inheritance. That is, you can override the operation of a Class Level Method in a subclass, whereas if you used a static method you would not be able to override it.
    ….
    So, in general, you should use class level methods, not static methods, as it gives you the benefit of inheritance although it might feel a little weird. Then you call them using $class::model()->method().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the difference and relation between Page description language , markup language and
Relation between idc=courseID HTML of Grid view <asp:GridView ID=GridView1 runat=server AutoGenerateColumns=False DataKeyNames=id DataSourceID=EntityDataSource1> <Columns>
I am trying to understand the relation between TCP/IP and HTTP timeout values. Are
What's the difference between the MinGW project and the 32-bit portion of the MinGW-w64
I'm using the project.task model where delegation creates a parent/child link between both. When
What is the difference between adodb and oledb ? What is the relation between
I am trying to build a relationship model between users. A user can either
What is the relation between parser combinators and recursive descent parsers?
Is there any relation between doctype of an HTML document and browser rendering speed?
Ok so got through my last problem with the difference between Postgresql and SQLite

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.