Log message #4055611

# At Username Text
# Jul 21st 2017, 17:13 nemmons more or less, yeah.
# Jul 21st 2017, 16:55 Alex__ ok, models have changed a lot. Do most of the methods that used to go into model now go into table?
# Jul 21st 2017, 16:36 admad i think it's currently broken but you can fix it :slightly_smiling_face:
# Jul 21st 2017, 16:35 admad @viraj.khatavkar https://github.com/cakephp/codeception
# Jul 21st 2017, 16:35 viraj.khatavkar Because it would do an actual HTTP request?
# Jul 21st 2017, 16:35 viraj.khatavkar But will the above thing work with Codeception then?
# Jul 21st 2017, 16:34 admad everything is done within same process
# Jul 21st 2017, 16:34 nemmons okay that makes sense, thanks admad
# Jul 21st 2017, 16:34 admad s/not/no
# Jul 21st 2017, 16:33 jeremyharris also, alias requires two params
# Jul 21st 2017, 16:33 admad also there's not actual http request
# Jul 21st 2017, 16:33 admad there's no separate thread :slightly_smiling_face:
# Jul 21st 2017, 16:33 nemmons oh unless the post method isn't actually making a separate HTTP request but just generating a new request object in the same execution context
# Jul 21st 2017, 16:30 nemmons in relation to Viraj's question above - say in a test i do something like ` ConnectionManager::alias('other_connection'); $this->post('/some/url', $params]);` to test some URL in my application. This shouldn't actually work, because in the new PHP `thread` for executing the post request, the alias as defined above won't be persisted, because it's executing from a separate context. Right? Or am i completely misunderstanding how php works?
# Jul 21st 2017, 16:26 Alex__ Found it!
# Jul 21st 2017, 16:25 admad plus we have crud and crud-view plugins ;0
# Jul 21st 2017, 16:23 jeremyharris There is!
# Jul 21st 2017, 16:21 Alex__ Hi, I have a quick question. I haven't used cake in a while, and I haven't used 3 at all. Is there a baking functionality like there is with 2?
# Jul 21st 2017, 16:18 jeremyharris ah for tests, then yeah the alias approach is probably what you want
# Jul 21st 2017, 16:17 viraj.khatavkar I don’t want to do it on the Table class because this is a runtime configuration for tests that are to be run in Codeception
# Jul 21st 2017, 16:16 jeremyharris it might be better to overwrite getDefaultConnection on your table class, add a setDefaultConnection, and do it that way. Would probably be more clear to understand
# Jul 21st 2017, 16:11 jeremyharris that’s how the test database works, when your app code says “use the `default` connection to delete this thing” the alias will point to the test connection instead
# Jul 21st 2017, 16:10 jeremyharris well, `ConnectionManager::alias('other_connection', 'default')` basically says when someone uses the `default` connection, use the `other_connection` instead
# Jul 21st 2017, 16:09 viraj.khatavkar So doing `ConnectionManager::alias('other_connection')` would force the ORM to use the `other_connection` for all of its methods?
# Jul 21st 2017, 16:08 jeremyharris the other solution would be to change the default connection name in your tables (if you extend the table this would be easy)
# Jul 21st 2017, 16:07 jeremyharris you’d have to dropAlias when done though
# Jul 21st 2017, 16:07 jeremyharris similar to how cake sets an alias during tests (so that default resolves to the test connection instead): ConnectionManager::alias(‘otherConnection’, ‘default’)
# Jul 21st 2017, 16:05 viraj.khatavkar How do I do that? I am sorry but I am not getting what you are trying to say exactly
# Jul 21st 2017, 16:05 jeremyharris you could create a connection alias for the default connection to point to the other one
# Jul 21st 2017, 16:03 viraj.khatavkar Not for a specific table. I want it to run using a different connection for all of it’s methods
# Jul 21st 2017, 16:01 jeremyharris @viraj.khatavkar I believe you change the connection on the table
# Jul 21st 2017, 15:59 viraj.khatavkar Hi, I was wondering how do I tell the ORM in runtime to use a specific connection.
# Jul 21st 2017, 15:46 gutts sweet, thank you neon1024
# Jul 21st 2017, 15:46 neon1024 :P
# Jul 21st 2017, 15:46 neon1024 Then,, er Collection!
# Jul 21st 2017, 15:46 neon1024 Then use a resultsMap function
# Jul 21st 2017, 15:45 neon1024 Then use matching to filter the comments by author
# Jul 21st 2017, 15:45 neon1024 As you could also contain Authors for Posts and Comments separately if you wanted using the same table instance, because the ORM is awesome like that :)
# Jul 21st 2017, 15:44 neon1024 Hopefully the parenthesis match up! ;P
# Jul 21st 2017, 15:44 neon1024 This is the kind of thing I’d do :slightly_smiling_face:
# Jul 21st 2017, 15:44 neon1024 https://gist.github.com/davidyell/a1fe56cc13481d2336f03cffc745d4ed