Logs for #cakephp

Page 1 of 36,522, showing 100 records out of 3,652,150 total, starting on record 1, ending on 100

# At Username Text
# Today, 04:04 cnizzardini Are there any JWT examples for CakePHP 4?
# Yesterday, 20:07 trash.mail.collector yeah, that was it... I had an error in one of my apache config files... thanks @ndm
# Yesterday, 19:46 ndm First thing I'd check is `mod_rewrite`
# Yesterday, 19:45 trash.mail.collector I'm sure it's not being hit. I just can't figure out why not. / is definitely hitting the PagesController, but /users isn't hitting UsersController
# Yesterday, 19:43 ndm What exactly do you mean by "_default error page_"? The default apache error page? That would mean your application isn't being hit.
# Yesterday, 19:41 trash.mail.collector I have 'debug' => true in app.php and app_local.php, but I still only get the default error page (and no errors in the cakephp logs -- the 404 only shows up in apache's access log)
# Yesterday, 19:40 ndm Enable debug mode to get a proper error page that details the actual error.
# Yesterday, 19:37 trash.mail.collector Cake 4.0.3: I just created skeleton code for users ("bin/cake bake all users"), but I'm getting 404s for all of the actions when I try to access /users or /users/*. I have "$builder->fallbacks();" in config/routes.php, but even when I explicitly map a route (e.g., "$builder->connect('/users', ['controller' => 'Users', 'action' => 'index']);"), I still get a 404. Any ideas?
# Yesterday, 17:24 noel So there are two ways to go here that I know of... A: use `$this->posts->get()` and then transform the data structure you get back. The disadvantage is you loop twice. B: write your own custom SQL and iterate just once, building up a custom data structure.
# Yesterday, 17:21 noel Strange format you're looking for.
# Yesterday, 17:20 noel You wouldn't override it, you just transform the request's output, as I understand it (I'm drawing on my cakephp 2.x knowledge here, it might be different in 3.x)
# Yesterday, 17:15 hollistergraham123 How would I override the Hash method for the request
# Yesterday, 17:14 hollistergraham123 This would be the expected output
# Yesterday, 17:14 hollistergraham123 ```$post = $this->Posts->get(1, ['contain' => ['Categories']]; $post = [ 'id' => 1, 'name' => 'Lorem Epsium', 'categories' => [ 'categories' => [ [ 'id' => 1, 'name' => 'Lorem Epsium' ], [ 'id' => 2, 'name' => 'Lorem Epsium' ], ], '_ids' => [1, 2] ] ]```
# Yesterday, 17:12 hollistergraham123 ```$post = $this->Posts->get(1, ['contain' => ['Categories']];```
# Yesterday, 17:09 noel If I understand you correctly
# Yesterday, 17:09 noel @hollistergraham123 yes look at `vendor/cakephp/src/Utility/Hash.php`
# Yesterday, 16:34 hollistergraham123 Is there a way to change the output of associations. Like rather then being like post->categories being an array of categories we’d do post->categories then an array of categories and _ids with categories being an array of the categories objects and _ids being an array of their primary key
# Yesterday, 15:25 matthttam @admad It is using the new auth plugin.
# Yesterday, 14:48 noel Hi all. I'm about to try out the ORM's transactions: https://book.cakephp.org/3/en/orm/database-basics.html#using-transactions. I'm using `friendsofcake/CRUD`. Can I implement a transaction within the `beforeSave()`event listener? I'm concerned that it might somehow interfere with the actual save?
# Yesterday, 06:52 challgren authentication/authorization now @admad
# Yesterday, 06:35 admad I have never used the cakedc/users plugin so don't know if the cake 4 compatible version uses the new auth plugin or still the core AuthComponent hence can't tell how to configure it to use the custom finder
# Yesterday, 05:29 slackebot that I can add a new finder name?...Or is there a place in the config to set this value? What am I passing to it exactly? Should userModel be changed to MyUsers? I'm assuming 'finder' would be set to whatever custom function I used in the previous paragraph; 'FindMyUsers' for example. Thanks again for the help though. I'm learning quickly but still feel very slow right now.
# Yesterday, 05:29 slackebot that. I found the Custom Finder Methods from the documentation. So maybe a function like FindMyUsers? I'm not sure what to name it. I'm assuming it can use the code above to get the appropriate data though. _and use `finder` config of `OrmResolver` of the auth plugin to use that finder_ I'm looking at the source of authentication/src/Identifier/Resolver/OrmResolver now. I sort of get it but don't understand. Where would I need to call OrmResolver so
# Yesterday, 05:29 matthttam @admad Thanks for the response :) I hope you like questions because I understood some of what you said but man I am confused. _setup association between your users model and profiles model._ The Model/Table/MyUsersTable which extends the CakeDC\Users\Model\Table\UsersTable has an association which is allowing the above code to work. So I think that is done. _Then create a custom finder in users which contains the profile_ Thank you for
# Yesterday, 04:55 admad @matthttam setup association between your users model and profiles model. Then create a custom finder in users which contains the profile and use `finder` config of `OrmResolver` of the auth plugin to use that finder
# Yesterday, 03:45 matthttam Maybe I should be storing this value in the session data on some kind of afterLogon hook....
# Yesterday, 03:42 slackebot `         `$user = $Users->get($current_user_id, [`             `'contain' => ['Profiles']`         `]);`         `$api_key = $user->profile->freshservice_api_key;`         `$this->set(compact('api_key'));`
# Yesterday, 03:42 slackebot configure that the Users table should always use a different class and entityclass? `// Query Users Table`         `$Users = (new TableLocator())->get('Users', [`             `'className' => 'App\Model\Table\MyUsersTable',`             `'entityClass' => 'App\Model\Entity\MyUser',`         `]);`         `$current_user_id = $this->getRequest()->getAttribute('identity')['id'];` `       
# Yesterday, 03:42 matthttam So I'm using CakeDC/Users plugin and I've extended the table and entity by creating MyUsersTable and MyUser. This is to create a Profiles table that link and store additional values; I didn't want to modify the users table directly honestly. So if I wanted to query the Users table and pull an API key stored in their profile this is the best I could come up with. Is there a cleaner way to do this or that about right? Like is there a way to
# Feb 22nd, 22:06 cnizzardini Also does anyone know where I tell cake what the token it should be using is for Authentication.Token
# Feb 22nd, 21:33 cnizzardini Has anyone implemented the cakedc/users plugin as an api service? or does it strictly require html views etc..
# Feb 22nd, 18:18 matthttam And I just found the log/error.log file. :) I am so slow sometimes.
# Feb 22nd, 18:11 matthttam So my app is throwing an error and I want to export a stacktrace. Debug kit shows a Missing Datasource Configuration exception. How do I make a stacktrace file? I don't know where to put a debugger command so that it generates an actual stacktrace.
# Feb 22nd, 18:09 matthttam :+1:@davinci No problem. Good luck
# Feb 22nd, 18:08 davinci ok, thanks much. I'm headed in the right direction now
# Feb 22nd, 18:08 matthttam You either need to figure out the environment variable that changes where it is looking for php. or make a link there so it'll work. I'm not sure how or which is best honestly.
# Feb 22nd, 18:06 davinci ah - that's no good
# Feb 22nd, 18:06 matthttam it is looking in /usr/bin/php for your php install.
# Feb 22nd, 18:06 davinci `/c/wamp64/bin/php/php7.4.0/php`
# Feb 22nd, 18:06 matthttam can you do a _which php_
# Feb 22nd, 18:05 davinci @matthttam now it says `bash: bin/cake.php: /usr/bin/php: bad interpreter: No such file or directory`
# Feb 22nd, 18:05 matthttam :,)Good cause I was very confused lol
# Feb 22nd, 18:05 davinci oh, sec - moved up into bin.
# Feb 22nd, 18:05 davinci I'm in the main directory of my app
# Feb 22nd, 18:04 matthttam uhh... do a pwd for me... are you in the right directory?
# Feb 22nd, 18:04 davinci @matthttam when I try `bin/cake.php` it just says: `bash: bin/cake.php: No such file or directory`
# Feb 22nd, 18:00 matthttam @davinci When you run cake.php do you have to do _php bin/cake.php_ or are you able to just do _bin/cake.php_?
# Feb 22nd, 17:55 davinci but trying to figure out why I wouldn't then also be able to run just `bin/cake`
# Feb 22nd, 17:55 davinci I CAN run `php bin/cake.php`
# Feb 22nd, 17:54 davinci I think it's called mintty
# Feb 22nd, 17:54 davinci MINGW64
# Feb 22nd, 17:54 davinci I'm running it in windows10, in the git cli app
# Feb 22nd, 17:53 chris301 basically, in a test scenario i don’t care about the aftersave data funcitonality for a test, and don’t want to have to mock all of the other things required in there
# Feb 22nd, 17:53 chris301 so, quick question - is there still a way of disabling aftersaves from being triggered?
# Feb 22nd, 17:52 slackebot <matthttam>
# Feb 22nd, 17:52 matthttam Mine are slightly different but it shouldn't matter... and you are running this from within Windows 10 ubuntu?
# Feb 22nd, 17:51 slackebot <davinci>
# Feb 22nd, 17:51 matthttam "ls -ls"
# Feb 22nd, 17:50 slackebot <davinci>
# Feb 22nd, 17:50 matthttam Can you do an ls -ls on bin/ and ensure that the permissions on cake are correct?
# Feb 22nd, 17:49 davinci Trying to install CakePHP 4, and all seems well. I have the welcome app page up and running. But I can't use `bin/cake` . It just throws: `Could not open input file: /C/Users/Documents/mysite/bin/cake.php`
# Feb 22nd, 17:28 matthttam @admad Sure. Uhh. the debug_kit page shows a stack trace... not sure how to export that in a meaningful way.
# Feb 22nd, 16:19 admad @matthttam sorry but the info you have provided in the issue is not enough for me to be able to provide any useful response. Maybe if you provide an actual stack trace it might be helpful
# Feb 22nd, 16:12 ndm Looks like + is special: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent#Decoding_query_parameters_from_a_URL
# Feb 22nd, 16:10 wizardfix That doesn't work for spaces though: `$this->response = $this->response->withCookie(new Cookie('email', 'words with spaces'));` results in ```document.cookie "email=words+with+spaces" decodeURIComponent(document.cookie); "email=words+with+spaces"```
# Feb 22nd, 16:08 slackebot everything. Thanks again :)
# Feb 22nd, 16:08 matthttam @admad Hey! I was the Bil8411 from IRC earlier. I submitted issues 87 for the beta of muffin/webservice:^3.0 yesterday. Just wanted to say thanks for the response. I was finally able to pull an endpoint from the remote API (yay). If the issue I submitted isn't really an issue maybe you can help me fix it so the config being pulled isn't datasource -> app. I'm new to cakephp in general so I'm drinking from a hose on the best way to do
# Feb 22nd, 16:05 wizardfix Ah, ok thanks @ndm :)
# Feb 22nd, 16:01 ndm It's simple URL encoding which you should be able to decode using `decodeURIComponent()`
# Feb 22nd, 16:00 ndm That is because per the specs, only US ASCII characters excluding control characters, whitespaces, double quotes, commas, semicolons, and backslashes are allowed in cookie values.
# Feb 22nd, 15:51 wizardfix (3.8)... If I set a cookie like this: `$this->response = $this->response->withCookie(new Cookie('email', 'test@example.com'));` when I read it at the front end it has `@` replaced with `%40`. ```document.cookie``` Spaces also get replaced with plus signs. I wonder why this is and how to handle it?
# Feb 22nd, 15:31 challgren @etibor shouldnt be too painful. Really just type defining things. I think they learned the lesson from 2.x to 3.x
# Feb 22nd, 15:29 st.steinkuehler @etibor perhaps this will help you https://github.com/dereuromark/cakephp-hashid - "Exposes hashids as drop-in replacement for your numeric primary keys"
# Feb 22nd, 15:22 etibor How do you prevent such as mysql injection localhost/cakephp-project/users-roles/delete/1 or something similar, unwanted add to users-roles table etc
# Feb 22nd, 15:21 etibor hopefully it will less painable than the changing to 3.0
# Feb 22nd, 15:21 etibor uh Jesus, once again a big upgrade
# Feb 22nd, 03:32 ron.rattie I'm glad you were able to get help from yourself.
# Feb 22nd, 02:41 challgren Cake 4.0.4 released https://github.com/cakephp/cakephp/tree/4.0.4
# Feb 21st, 18:11 ricksaccous AuthenticationComponent has setIdentity
# Feb 21st, 18:11 ricksaccous thanks anyways
# Feb 21st, 18:11 ricksaccous welp i fixed it, nevermind
# Feb 21st, 18:07 ricksaccous yep, i was right....
# Feb 21st, 18:02 ricksaccous i still don't know how the component knows whether to persist it though
# Feb 21st, 17:58 ricksaccous looking at AuthenticationComponent
# Feb 21st, 17:58 ricksaccous so this is intended behavior
# Feb 21st, 17:58 ricksaccous i suppose the token is meant to be passed throughout, rather than persisting
# Feb 21st, 17:50 ricksaccous but I don't understand why they'd behave differently
# Feb 21st, 17:50 ricksaccous and that's what's causing it
# Feb 21st, 17:50 ricksaccous I have a sneaking suspicion token isn't writing to Session for whatever reason
# Feb 21st, 17:48 ricksaccous hmmmmm
# Feb 21st, 17:47 slackebot <ricksaccous>
# Feb 21st, 17:46 ricksaccous I'll also show the authentication set up I have in middleware:
# Feb 21st, 17:45 ricksaccous Only log in action
# Feb 21st, 17:44 ricksaccous so
# Feb 21st, 17:44 ricksaccous I think this is nonsensical without showing some code
# Feb 21st, 17:43 ricksaccous the token identifier returns valid but it never redirects after "logging in" , the first identifier I have (form one) redirects fine
# Feb 21st, 17:42 ricksaccous I'm using a custom identifier along with a token identifier
# Feb 21st, 17:42 ricksaccous with using two identifiers in cakephp3
# Feb 21st, 17:42 ricksaccous I'm running into a strange issue