Logs for #cakephp

Page 6 of 36,478, showing 100 records out of 3,647,755 total, starting on record 501, ending on 600

# At Username Text
# Jan 22nd, 17:52 ricksaccous ok...
# Jan 22nd, 17:50 jslamka5685 messaging between two users
# Jan 22nd, 17:50 jslamka5685 It is to display a conversation
# Jan 22nd, 17:50 ricksaccous @jslamka5685 this is the problem you are trying to solve right?
# Jan 22nd, 17:49 ricksaccous are you wanting to reverse them because of possible nulls?
# Jan 22nd, 17:49 ricksaccous ....
# Jan 22nd, 17:49 mark.mikkelson couldn't you just use ?sort=dateanddirection=desc
# Jan 22nd, 17:40 jslamka5685 How can I reverse the item order in a pagintor object?
# Jan 22nd, 17:39 jslamka5685 To do this, I believe I need to select records in descending order and then reverse them
# Jan 22nd, 17:39 jslamka5685 When working with Cake3x paginator, I am looking to get the latest records in ASC order.
# Jan 22nd, 17:25 mark.mikkelson Afternoon all. (in 3.7.7) I'm trying to disable the CSRF middleware for a route or just entirely for the full cake app, but having no joy. I've implemented what's documented here: https://book.cakephp.org/3/en/controllers/middleware.html#cross-site-request-forgery-csrf-middleware (ie. modified application.php and config/routes.php) however, end up getting the same error "Error: Missing CSRF token cookie" when im making json posts to
# Jan 22nd, 17:25 slackebot my end point ( /tickets/update ) . I have this in my routes.php : `Router::scope('/tickets', function (RouteBuilder $routes) {` `});`
# Jan 22nd, 17:19 matt thanks for helping guys
# Jan 22nd, 17:18 matt deleting the table i felt was a good approch
# Jan 22nd, 16:33 neon1024 ..and allows easier re-indexing
# Jan 22nd, 16:26 ricksaccous that would invalidate the key constraint though, but i don't know if that wuold stop you from destroying/recreating the table
# Jan 22nd, 16:26 ricksaccous that's what i tend to do
# Jan 22nd, 16:26 ricksaccous after that use logic to refill the data if the data is necessary
# Jan 22nd, 16:26 ricksaccous destroy the table in a migration and recreate it
# Jan 22nd, 16:25 ricksaccous when trying to change the primary key to another column it's usually not worth it
# Jan 22nd, 16:25 matt i think it worked but when it tried to backfill the table it sets all to 0
# Jan 22nd, 16:25 matt PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY' in /home/vagrant/Apps/clubtrac.local/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PdoAdapter.php:16
# Jan 22nd, 16:24 ndm https://book.cakephp.org/phinx/0/en/migrations.html#working-with-foreign-keys
# Jan 22nd, 16:24 matt will try that
# Jan 22nd, 16:23 ndm So there's a foreign key constraint that you need to drop first
# Jan 22nd, 16:23 matt gives me this error
# Jan 22nd, 16:22 matt DOException: SQLSTATE[HY000]: General error: 1553 Cannot drop index 'PRIMARY': needed in a foreign key constraint in /home/vagrant/Apps/clubtrac.local/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PdoAdapter.php:16
# Jan 22nd, 16:22 ndm Also what does "doesn't work" mean exactly?
# Jan 22nd, 16:22 ndm Have you changed your respective CakePHP table class accordingly too?
# Jan 22nd, 16:21 matt doesnt work
# Jan 22nd, 16:21 matt i tried this
# Jan 22nd, 16:21 matt ``` $table->addColumn('id','integer', [ 'length' => 11, 'null' => false, 'default' => null, ]); $table->changePrimaryKey(['id']);```
# Jan 22nd, 16:20 ndm @matt There's the `changePrimaryKey()` method: https://book.cakephp.org/phinx/0/en/migrations.html#changing-the-primary-key
# Jan 22nd, 16:15 matt ```attendees(id,member_id,occ_id) - new table```
# Jan 22nd, 16:15 em That could clarify this situation a little bit i think
# Jan 22nd, 16:15 matt ```attendees(member_id,occ_id) - old table```
# Jan 22nd, 16:14 matt i need the new primary key to be a 'id' column
# Jan 22nd, 16:14 matt How do i change the primary key of table that was earlier using a composite key from a migration?
# Jan 22nd, 16:13 ndm I wonder if the validator should maybe pass a custom flag into the context argument, so that one could properly determine how the method is invoked
# Jan 22nd, 16:12 ndm You're welcome
# Jan 22nd, 16:10 em @ndm now i see that isEmptyAllowed() has no data parameter at all :) And i got about custom validation, Thank you :)
# Jan 22nd, 16:09 ndm You need to understand that these rules are invoked in different scenarios, and account for no data being present accordingly. In forms, the rule will be invoked to determine whether to set the `required` attribute on the HTML element. If you can't work out something that works in both form context and actual data validation context, then you'll probably need a custom validation rule instead.
# Jan 22nd, 16:06 em @ndm Okay, so i should not use $validator->notEmptyString() for that purpose, right ?
# Jan 22nd, 16:04 ndm The form context couldn't pass any data even if it wanted to, as the validator API (`\Cake\Validation\Validator::isEmptyAllowed()`) doesn't support that
# Jan 22nd, 16:02 ndm If you are referring to it being invoked when you create form controls (as opposed to validation being executed when you patch/create your entity with the submitted form data), then yes, that is expected.
# Jan 22nd, 16:00 em @ndm In controller i get my user entity with $this->Users->get($id); Then i pass this user entity into the view. There i create form like this: ```<?php echo $this->Form->create($user); ?> <?php echo $this->Form->control('firstname') ?> <?php echo $this->Form->control('lastname', ) ?> <?php echo $this->Form->submit(__('Save')); ?> <?php echo $this->Form->end(); ?>``` So, i do not specify any context for this form. I expected that data will be
# Jan 22nd, 16:00 slackebot passed to validator, but it does not. Is it expected like this ?
# Jan 22nd, 15:58 ndm you're welcome
# Jan 22nd, 15:57 ndm @em In which context (application wise) is the data empty? Are you specifically refering to when its invoked as a part of creating form controls? In that case it's expected to be empty, as the form context doesn't try to pass in any data
# Jan 22nd, 15:56 crayfishuk @ndm thanks :)
# Jan 22nd, 15:50 crayfishuk Good advice re being familiar with the destination - obvious when you say it out loud :grinning:
# Jan 22nd, 15:50 crayfishuk Good point. We've been in v2 for years. Only recently getting our heads round v3!
# Jan 22nd, 15:49 em ```$validator->notEmptyString('name', __('Specify your name'), function($context) { if (isset($context['data']['role'])) { return $context['data']['role'] === 'partner'; } return false; });``` I have trouble with $context[‘data’]. Somehow it is always empty even if i add entity to $this->Form->create($user); Does anyone have any ideas ? I use cake 4 version
# Jan 22nd, 15:49 ndm @crayfishuk That really depends on the complexity of the application. You most likely won't get it into a working state just by using the upgrade tool, I've yet to see even one application for which that worked, but if it's not to complex, and largely follows the conventions, then an upgrade could be the way to go to avoid all the repetitive tasks. I'd always recommend to first make yourself familiar with the version that you're upgrading too, to
# Jan 22nd, 15:49 slackebot the point that you'd be able to create a robust application with it, that will answer lots of upgrading questions, and make it easier in general.
# Jan 22nd, 15:48 crayfishuk Aha - found it :) https://github.com/rectorphp/rector
# Jan 22nd, 15:45 crayfishuk Rector?
# Jan 22nd, 15:44 ricksaccous so you have a series of upgrade scripts that an help
# Jan 22nd, 15:44 ricksaccous there's also an upgrade script though that dereuromark created
# Jan 22nd, 15:44 ricksaccous not sure if rector handles that
# Jan 22nd, 15:44 ricksaccous that might be easier since you have rector
# Jan 22nd, 15:43 crayfishuk @ndm Does that go for a 2.10 to 3.x migration too?
# Jan 22nd, 15:10 kiwi_92 Indeed. That's what our plan is for this year. We were considering Laravel, but I have always liked Cake and hoped upgrading might be faster.
# Jan 22nd, 15:08 spriz Rather migrate it while it works and no huge security holes has been found ;P
# Jan 22nd, 15:08 kiwi_92 Thank you
# Jan 22nd, 15:08 kiwi_92 It still works well but obviously very outdated.
# Jan 22nd, 15:07 kiwi_92 Haha, that's what I feared. The app has several years of development in it. Not a small job. :D
# Jan 22nd, 15:07 spriz @ndm Ideally I think a method where with the signature of `($field, $maxDigits, $maxDecimals)` would make sense :D
# Jan 22nd, 15:06 ndm @kiwi_92 Rewrite the application from scratch
# Jan 22nd, 15:06 ndm @spriz There's the `decimal` rule... and `lessThanOrEqual` seems fine, doesn't it?
# Jan 22nd, 15:03 kiwi_92 I have a Cake 1.3 application. If I want to upgrade it to Cake 4.0, what's the recommended route? Upgrade to 2.x, then 3.x, then 4.x?
# Jan 22nd, 14:52 spriz Also any more sneaky way to ensure it stays witin range than `->lessThanOrEqual('price', 999999999.999)` ?
# Jan 22nd, 14:52 spriz Any sneaky way to make sure only values with 3 decimals are put into an entity? (eg. DECIMAL(12,3) )
# Jan 22nd, 13:26 matt Hi, is there a way to concat breadcrumb globally
# Jan 22nd, 11:52 thomas078 Thanks! This is exactly what i need
# Jan 22nd, 11:51 jotpe Hey
# Jan 22nd, 09:58 neon1024 Ahoy!
# Jan 22nd, 09:26 challgren Evening all
# Jan 22nd, 08:54 alexdd55976 morning
# Jan 22nd, 08:03 tobse @thomas078 I am using https://phpdocker.io/generator to build my docker-containers with nginx and I have no Header "nosniff"
# Jan 22nd, 07:58 neon1024 iquana I think people have used this one in the past https://github.com/alt3/cakebox
# Jan 22nd, 07:06 javier.villanueva If I have a "belongsTo" association (A belongsTo B) with "select strategy"... Can I get specific fields of B in a find of A?
# Jan 22nd, 07:03 thomas078 any help much appreciated
# Jan 22nd, 07:02 thomas078 i think that this adds nosniff
# Jan 22nd, 07:02 thomas078 trying to run cake on https://hub.docker.com/r/wyveo/nginx-php-fpm
# Jan 22nd, 06:54 thomas078 good. so it must be then my nginx
# Jan 22nd, 06:52 admad cake doesn't add any such header
# Jan 22nd, 06:51 javier.villanueva morning all
# Jan 22nd, 06:51 thomas078 one problem i have now is that i get X-Content-Type-Options: nosniff. Not sure if it is added by cakephp or nginx
# Jan 22nd, 06:46 thomas078 nginx
# Jan 22nd, 06:46 thomas078 trying to find proper docker php-fpm container to run my cakephp 3 app. Any suggestions
# Jan 22nd, 01:26 luizcmarin @challgren "doesnt seem like a file upload plugin" ... I better go to sleep ...
# Jan 22nd, 00:48 challgren https://github.com/josbeir/cakephp-filesystem is the only CakePHP 4 plugin for file uploading right now. https://github.com/friendsofcake/awesome-cakephp#files
# Jan 22nd, 00:47 challgren laminas/laminas-diactoros doesnt seem like a file upload plugin
# Jan 22nd, 00:44 luizcmarin I need to attach images to the register. Any information on how to use "laminas/laminas-diactoros" to do this in cake4? I have a varchar field (255).
# Jan 21st, 18:33 ricksaccous awesome
# Jan 21st, 18:31 jotpe @ricksaccous This works: `<?= $this->Form->control('items', ['multiple' => 'checkbox', 'options' => $optionalItems, '*value*' => $selected]) ?>`
# Jan 21st, 18:30 jotpe I set the Items in my Controller then manually
# Jan 21st, 18:30 jotpe This is unfortunately not an option. I need to seperate the Items into RequiredItems/OptionalItems. I don't want the RequiredItems as Checkboxes
# Jan 21st, 18:29 ricksaccous is this some sort of custom structure that isn't being saved but acted upon?