Chapters
33 Chapters
|
3:02:08
|
Login to bookmark this video
-
Course Code
Subscribe to download the code!Compatible PHP versions: ^7.2.0
Subscribe to download the code!Compatible PHP versions: ^7.2.0
-
This Video
Subscribe to download the video!
Subscribe to download the video!
-
Subtitles
Subscribe to download the subtitles!
Subscribe to download the subtitles!
-
Course Script
Subscribe to download the script!
Subscribe to download the script!
08.
Organizing with Objects!
Scroll down to the script below, click on any sentence (including terminal blocks) to jump to that spot in the video!
Subscribe to jump to this part in the video!
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
This tutorial uses an older version of Symfony... but since it's a JavaScript tutorial, the concepts are still ? valid!
What PHP libraries does this tutorial use?
// composer.json
{
"require": {
"php": "^7.2.0",
"symfony/symfony": "3.1.*", // v3.1.10
"twig/twig": "2.10.*", // v2.10.0
"doctrine/orm": "^2.5", // v2.7.1
"doctrine/doctrine-bundle": "^1.6", // 1.10.3
"doctrine/doctrine-cache-bundle": "^1.2", // 1.3.2
"symfony/swiftmailer-bundle": "^2.3", // v2.4.0
"symfony/monolog-bundle": "^2.8", // 2.12.0
"symfony/polyfill-apcu": "^1.0", // v1.2.0
"sensio/distribution-bundle": "^5.0", // v5.0.22
"sensio/framework-extra-bundle": "^3.0.2", // v3.0.16
"incenteev/composer-parameter-handler": "^2.0", // v2.1.2
"friendsofsymfony/user-bundle": "~2.0@dev", // dev-master
"doctrine/doctrine-fixtures-bundle": "~2.3", // v2.4.1
"doctrine/doctrine-migrations-bundle": "^1.2", // v1.2.1
"composer/package-versions-deprecated": "^1.11", // 1.11.99
"friendsofsymfony/jsrouting-bundle": "^1.6" // 1.6.0
},
"require-dev": {
"sensio/generator-bundle": "^3.0", // v3.1.1
"symfony/phpunit-bridge": "^3.0" // v3.1.6
}
}
9 Comments
Hello knp :)
Is it possible to pass variables into the event listener callback ?
Hey Virgile!
Hm, do you have an example of the code? How does your code looks like and what you're trying to do? Probably you can just pass variables as arguments to the callback?
Cheers!
Hello victor, thanks for taking care of my problem
Here is a ajax call
success:function (response) {
},
`success:myobject.success(this.response)
`my response is undefined ..
Hey Virgile,
The method will be called by a caller somewhere in jQuery internals and so the proper argument will be passed by caller as well. You should not worry to pass the argument because you don't have it yet. Also, if you want to set a function - you should not add parentheses to it, otherwise it will be called instead of set. Try this:
Please, note there is no "()" at the end of "myobject.success" - we need to set that function instead of call it right now, it will be called later.
Cheers!
Hi Max
the wrapper object that is passed why do we need to make it a property can't we directly work on it? Instead of $this.wrapper. everywhere we could just work with $wrapper?
Hey Abdul,
Because we'll use that wrapper on other method of RepLogApp, e.g. see handleRepLogDelete() in the last code block. So if we don't set it on a class property, we won't be able to use it there, because we can't pass the wrapper into that method.
Cheers!
Hey guys!
As always amazing work - highly instructive and fun to code along!
There is no equivalent of a __construct() function in js, right? As well call initialize explicitly...
Yo Max,
Thanks a lot! And that's a really good question. Well, yes and no :) Actually, JS has ability to add constructors, but not in that form we see it in PHP classes. Just go further and you will see how to add a constructor... but if you can't wait - take a look at: https://knpuniversity.com/s...
Cheers!
Thx! I'm going to hit that one soon ;)
"Houston: no signs of life"
Start the conversation!