Post::model()->find(); versus Post::find();

What is the difference between these two?




Post::model()->find();

Post::find();



Since the find() method does not access the specific model attributes, what is the point of using ::model()?

I always see it written the first way and only thing I can think of is that model() caches the AR meta info. Or am I missing?

find() is not a static method of the AR model.

So you have to create an instance first by Post::model()

Take a look at the implementation code

It’s also worth to mention Post::model() will return the “class instance”, created on the first instantiation of the Post class.

/Tommy