Advertisement
Guest User

Untitled

a guest
May 16th, 2017
574
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.59 KB | None | 0 0
  1. <lsmith> aloha fabien
  2. <lsmith> give me 5 mins .. finishing up a scrum meeting
  3. --> gerryvdm_work (~gerryvdm@office.morris-chapman.be) has joined #symfony
  4. --> jetienne (~jerome@ivr94-6-82-230-255-246.fbx.proxad.net) has joined #symfony
  5. --> noginn (~noginn@86.12.191.129) has joined #symfony
  6. <Seldaek> fabpot, lsmith, feel free to discuss that here :)
  7. --> alecs (~alecs@82.208.174.229) has joined #symfony
  8. --> jetienne_ (~jerome@ivr94-6-82-230-255-246.fbx.proxad.net) has joined #symfony
  9. <-- alecs (~alecs@82.208.174.229) has left #symfony
  10. <fabpot> Seldaek: we will
  11. --> [OES] (~leesmith@client-86-23-54-218.brhm.adsl.virginmedia.com) has joined #symfony
  12. <lsmith> ok ready fabpot
  13. <fabpot> lsmith: I suppose you are not convinced with my last email, are you?
  14. <lsmith> fabpot: well lets say i just want to go through it .. i am not convinced in either direction
  15. <Seldaek> the main benefit I see, from what we did here, is that you can easily inject config variables in every controller, and they're all in one place (SC config)
  16. <Seldaek> apart from that, I don't really care either way about injecting or pulling services, so I'll let you guys beat that horse :p
  17. <lsmith> yeah .. my main point is .. the SC is able to handle injection
  18. <fabpot> Seldaek: ok, perhaps we can fast forward the discussion easily if you read my last email about my last week experiments
  19. <lsmith> and so why introduce a separate concept for injection into controllers
  20. <fabpot> basically, my last experiments shows that we need the Container to be injected anyway in the controllers
  21. <lsmith> but i do see your argument as well .. having the SC instance inside the controller makes a lot of situations easier
  22. <fabpot> this is not a separate concept
  23. <fabpot> a controller is a totally different beast
  24. <fabpot> it's not a "global" object
  25. <lsmith> well
  26. <fabpot> it's more like a Model object, and models are not managed by the DI either
  27. <lsmith> its still injection .. and in one place you inject via the SC .. and in the other with a naming convention
  28. <epic_shadows> what are you guys working on ?
  29. <lsmith> epic_shadows: symfony2
  30. <epic_shadows> cool
  31. <fabpot> well, then why not use the DI to manage your models?
  32. <fabpot> or any other class for that matter
  33. <Seldaek> lsmith: actually, what he proposed last is to just inject the SC, and no naming conventions at all
  34. <lsmith> what about parameters?
  35. <Seldaek> $sc['param'] $sc->service
  36. <lsmith> let me check if i overlooked something
  37. <Seldaek> but those are global sc params, not defined per controller
  38. <lsmith> right .. what about sc specific parameters?
  39. <Seldaek> which is what I prefer about the full DI for controllers, that you can easily have one parameter array for each controller
  40. <fabpot> what do you mean by "specific"?
  41. <lsmith> the maxPerPage thingi
  42. <-- mgco3 has quit (Remote host closed the connection)
  43. <fabpot> $container['maxPerPage']
  44. <Seldaek> I guess you could do: parameters: controllerFoo: [], contorllerBar: [] etc
  45. <lsmith> well what if you want different maxPerPage per controller?
  46. <Seldaek> and then grab $sc['controllerFoo']
  47. <victoria> hi, where can I find the description for all the options in generator.yml (sfDoctrineGenerator)?
  48. <fabpot> you can define and manage the parameters the way you want
  49. --> Kasu (~some@81-234-83-185-o1122.telia.com) has joined #symfony
  50. <fabpot> $container['controllers.post.maxPerPage']
  51. <lsmith> well .. some level of standardization here would be good to help people share code
  52. <lsmith> we all know you can do anything you want with symfony2 :)
  53. <fabpot> of course, that's really about documentation and convention
  54. <fabpot> documentation will be very important with Symfony 2 to avoid people doing "stupid" things
  55. <lsmith> so what are the drawbacks of using the SC for controller?
  56. <lsmith> the main one was optional dependencies
  57. <fabpot> you mean, the drawbacks of using SC to create controllers?
  58. <lsmith> let me read your email again .. because i didnt really understand this "we must" pass the SC to th controller
  59. <lsmith> fabpot: yes
  60. <fabpot> lsmith: hehe, I don't even know where to start
  61. --> andyman3000 (~Miranda@e177222203.adsl.alicedsl.de) has joined #symfony
  62. <lsmith> the main issue i currently see is optional dependencies
  63. <fabpot> I don't want to force people to create XML/YAML/... for every controller
  64. <andyman3000> hi am am having issues with unit testing
  65. <fabpot> and if we generate those automatically for them, then your point is moot
  66. <andyman3000> i cannot load helpers in my unit tests. i alwys get ' The "default" context does not exist.'
  67. <lsmith> fabpot: well in most cases you will need the same dependencies in most controllers
  68. <Seldaek> fabpot: one thing though, I see yout point aobut making it easy and "hiding" the DIC from most coders, but is that really realistic? Don't you think you'll always end up in a situation when you'll need to define your own service and will have to learn about it?
  69. <lsmith> and in the cases where you dont .. you can just manually change the generated defaults
  70. <fabpot> lsmith: ok, but "most cases" means you cannot have one way to create controllers
  71. <fabpot> Seldaek: that's also why I favor Approach 1 now
  72. <andyman3000> is there a way to get around this somehow? i tried to change the bootstrapping but no luck
  73. <lsmith> fabpot: the way i see it .. you generate a new controller .. with a default config in the SC . if you need to change the services injected by default .. you edit the SC config (and your controller class)
  74. <fabpot> lsmith: but a service definition is only for one given class. It's not generic. So, I don't understand how you can have one default service definition
  75. <lsmith> what i love about the sc is .. i have a single location where i can find all my deps
  76. <lsmith> say i change a service ..
  77. <lsmith> with everything in the SC .. i can just have a look there and know what will be affected
  78. <Seldaek> fabpot: I think he means generate a default config into the sc when you create a new controller with the CLI tool
  79. * lsmith nods to Seldaek
  80. <fabpot> Seldaek: that's a nightmare. You will have tons of controller definitions in your XML configuration file, and in the cache
  81. <lsmith> fabpot: we have them in a separate yaml file we import
  82. <fabpot> ... and it is not needed as soon as you realize that most controllers need the Container anyway
  83. <lsmith> but that means its impossible to know the dependencies of your controller
  84. <lsmith> because they all can essentially depend on anything
  85. <Seldaek> fabpot: myeah, we got a controller.yml with 20 controllers defined here, it's a bit long but not too bad with merge keys
  86. <fabpot> the separate file changes nothing as everything is compiled down to one PHP class
  87. <Seldaek> which is sitting in apc.. :)
  88. <lsmith> fabpot: so you are worried about the performance?
  89. <fabpot> 20 controllers is nothing is a real project
  90. <Seldaek> hey it's a very real project:)
  91. <fabpot> lsmith: not really about the performance, more about having a clean, simple approach
  92. <fabpot> Seldaek: I don't say the contrary, just that when you will start to install bundles, they will come with their own controllers, and it will add up quickly
  93. <lsmith> well i am not convinced how your approach is any more clean or simple
  94. <fabpot> ok, how do you import the bundle controller configurations?
  95. <fabpot> I mean, third party bundles
  96. <lsmith> import :)
  97. <fabpot> you have installed
  98. <jamiel> andyman3000: You need to create a fake context to test if your class you are testing depends on helpers, ... just like your functional test does (see test/bootstrap/functional.php)
  99. <lsmith> i like being able to disable things in the SC too
  100. <lsmith> like i want to disable a controller
  101. <lsmith> i can just do so in the SC
  102. <fabpot> lsmith: you mean that the developer will need to import this by hand?
  103. <lsmith> think of /. effects
  104. <lsmith> fabpot: yes
  105. <lsmith> no magic :)
  106. <fabpot> lsmith: but not simple anymore
  107. <fabpot> that's a lot of things you need to know
  108. <lsmith> why is it not simple? i think we both agree that developers will need to know the SC config
  109. <andyman3000> jamiel: thanks
  110. <fabpot> ok, but they need to be able to start playing with Symfony 2 without too much knowledge
  111. --> nresni (~nresni@actualys.pck.nerim.net) has joined #symfony
  112. <fabpot> that's the problem with symfony 1, you need to learn a lot before you can start playing with it
  113. <lsmith> a CLI command should get them up and running with a new controller quickly
  114. <fabpot> if you have a look at the current tutorial for Symfony 2, you will see that you can do a lot of things without knowing anything about the DIC
  115. <lsmith> if they need some additional services .. they have already stepped beyond the first "just playing"
  116. <lsmith> also with the controllers being managed by the SC
  117. <lsmith> you can work with bundles a lot better
  118. <lsmith> i think i have mentioned this on the list already
  119. <lsmith> say bundles depend on each other
  120. <fabpot> not really, because the main services are hidden behind a getter like getUser, getRequest
  121. --> freezed (~52f489ab@gateway/web/freenode/x-nlgirnghnitypyht) has joined #symfony
  122. <freezed> Hello everybody
  123. <lsmith> like one bundles controller actually calls another controller
  124. <fabpot> that's already possible
  125. <freezed> How can I add a signin form from sfDoctrineGuardPlugin in the frontend app ?
  126. <lsmith> so in that case the controller would be in the SC?
  127. <fabpot> nope
  128. <fabpot> here is the forward implementation:
  129. <fabpot> return $this->container->getControllerLoaderService()->run($controller, $parameters);
  130. <lsmith> and what would $controller be?
  131. <lsmith> the name?
  132. <lsmith> and what if the controller that calls the other controller doesnt make the name configurable?
  133. <lsmith> if things would be managed by the SC .. it would be automatic
  134. <fabpot> yes: HelloBundle:Hello:fancy for instance
  135. <lsmith> imho .. we have the SC for good reasons .. and they also apply for controllers :)
  136. <fabpot> nope
  137. <fabpot> because we need to manage inheritance
  138. <fabpot> and that cannot be managed by the DIC
  139. <lsmith> to me the SC is about dependencies .. and less about managing instances
  140. <fabpot> When I say 'HelloBundle:Hello:fancy', it can be from Bundle\ or Application\
  141. <lsmith> but if i havent convinced you at all yet .. then i think its ok .. its not a be all end all decision for me
  142. <victoria> hi, sorry for repeating myself ...
  143. <victoria> where can I find the description for all the options in generator.yml (sfDoctrineGenerator)?
  144. <fabpot> lsmith: I will try to implement something like you describe to have a better feeling for it
  145. <fabpot> lsmith: playing with things is always better than long discussions ;)
  146. <lsmith> also i have a meeting in 15min where i am presenting
  147. <lsmith> need to prepare :-/
  148. * lsmith nods
  149. <fabpot> lsmith: ok, ttyl
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement