Log message #4046385

# At Username Text
# Jun 29th 2017, 15:23 neon1024 I’m curious as to how a project generates a requirement to build a php framework. Can you share with us why this is?
# Jun 29th 2017, 15:23 hmic baking *is* for a cakephp app specifically
# Jun 29th 2017, 15:23 hmic well, wait...
# Jun 29th 2017, 15:23 daveozoalor I'm particular about the CLI features. I need to be baking.
# Jun 29th 2017, 15:23 cleptric @daveozoalor Just follow my link. The README.md explains everything
# Jun 29th 2017, 15:23 hmic done.
# Jun 29th 2017, 15:23 hmic do to your app dir, enter: composer require cakephp
# Jun 29th 2017, 15:22 hmic but it's still possible and feasable to install cakephp as a requirement in a non-cakephp app and use whatever components without problems. the orm and shell are good candidates
# Jun 29th 2017, 15:22 daveozoalor Great, do you have a link to where I can read this process up?
# Jun 29th 2017, 15:21 hmic the orm is split out, sure. the shell things not so much
# Jun 29th 2017, 15:21 hmic daveozoalor: you can install cakephp as a dependency with composer in any non-cakephp project
# Jun 29th 2017, 15:21 cleptric There you go: https://github.com/cakephp/orm And don’t build a php framework. We already did that ;)
# Jun 29th 2017, 15:20 daveozoalor Thanks for that, sorry, I meant composer. I'm doing a project which requires me building a php framework, I have resorted to using Illuminate for ORM because I cant find one for CakePHP
# Jun 29th 2017, 15:14 cleptric @daveozoalor Right now, there is not a single shell package. We’re planning on doing that in the future, though :slightly_smiling_face: For example, you can use the ORM on it’s own. Also, normally you use composer for installing php stuff :slightly_smiling_face:
# Jun 29th 2017, 15:13 daveozoalor *there
# Jun 29th 2017, 15:12 daveozoalor How can I use only cake CLI features in the non-cakephp app I'm building? Are their cakephp packages I can install via npm and start using without having to install cakephp itself?
# Jun 29th 2017, 14:36 glanceded I see, ok, thanks for the tip and invite, maybe I can join the next's year fest.
# Jun 29th 2017, 14:35 neon1024 Check out the cakephp twitter feed, I think there are videos on there, but that’s just of the conference. You’ll have to attend the workshops next time :slightly_smiling_face:
# Jun 29th 2017, 14:34 glanceded @neon1024 I can't find anything about this year's fest. only 2016 amsterdam.
# Jun 29th 2017, 14:28 glanceded Sorry, my bad. You say about the this year event. Thanks for the tip
# Jun 29th 2017, 14:27 glanceded Thanks for the invite, I found it will be in 2018?
# Jun 29th 2017, 14:26 neon1024 @glanceded Cakefest this year there were some great examples of advanced routing in the workshops! ;)
# Jun 29th 2017, 13:42 glanceded I will after your advice, both solutions look realistic, even if I like the middleware one more, I will go with direct splitting in routes.php so I can make some tests
# Jun 29th 2017, 13:40 neon1024 No problem, hope you figure it out :slightly_smiling_face:
# Jun 29th 2017, 13:40 neon1024 https://github.com/cakephp/cakephp/blob/master/src/Routing/Middleware/RoutingMiddleware.php#L48
# Jun 29th 2017, 13:39 glanceded Wow, thanks a lot. Never thought about it. I will first try in my routes.php. If the request object isn't available, I will go with a middleware, since for now I don't have hundreds of routes. Thanks again for your time
# Jun 29th 2017, 13:38 neon1024 So it stands to reason that it should
# Jun 29th 2017, 13:38 neon1024 Well the routing needs to read the request to know where to route the request to right? ;)
# Jun 29th 2017, 13:37 glanceded even in routes.php?
# Jun 29th 2017, 13:37 glanceded the $this->request object is available global?
# Jun 29th 2017, 13:37 neon1024 Then if that didn’t work out, I might refactor and try with a middleware
# Jun 29th 2017, 13:37 neon1024 Personally I’d start by checking the request in the routing, if that’s possible, and building my routing around that
# Jun 29th 2017, 13:36 neon1024 Perhaps Middleware is too soon in the stack
# Jun 29th 2017, 13:35 neon1024 Although I think in your application, anywhere you have access to the request, you should be able to get the domain with `$this->request->getUri()`
# Jun 29th 2017, 13:35 neon1024 Well your Application.php has `->add(new RoutingMiddleware())` so you could pass the domain into the routing middleware perhaps, or roll your own, which then could pass the domain into the routing, perhaps as a parameter
# Jun 29th 2017, 13:31 glanceded Or how to load the correct set of rules?
# Jun 29th 2017, 13:31 glanceded @neon1024 Thanks for your answer. Yes, never thought at middlewares. So I create a middleware, I check the getHost() [domain]. But how to change the routes?
# Jun 29th 2017, 13:29 neon1024 @josexato Well I just check it `if (!empty($this->_properties['association']) {`
# Jun 29th 2017, 13:28 josexato @neon1024 thanks, I'll do some more tests because the child entity is contained when I serialize, can you please suggest me how can I check that the association exist or how can I recalculate again after query and before serialize?
# Jun 29th 2017, 13:28 neon1024 But if you’re using PSR7, the domain should be in the request, which you could use in your application
# Jun 29th 2017, 13:27 neon1024 @glanceded That sounds to me like it could be a good case for middleware