Search the Community
Showing results for tags 'property'.
-
I'm not sure how the second part of this example is related to the first, and where it belongs. I am quoting from page 174 of YiiBook2: # models/Page.php public function getUser() { return $this->hasOne(User::className(), ['id' => 'user_id']); } This means you can fetch every page with every page author in one step: $pages = Page::find()->with('user')->all(); I'm guessing that with('user') calls the getUser method. Is that right? But in which file does the second part of the example belong? In the view file?
- 1 reply
-
- getuser
- with(user)
-
(and 4 more)
Tagged with:
-
When To Use A Property Vs A Method?
kamaboko posted a topic in Modern Javascript: Develop and Design
Hello, Is there a rule I should think of when deciding to use a property vs a method? Thanks, K -
var U = { $: function(id) { 'use strict'; if(typeof id = 'string') { return document.getElementById(id); } // end of typeof } // end of $() function } // end U object This is a rather simple question. The text says the $() function is a property of U, isn't this function technically a method and not a property? Thanks, Mark