# |
Jan 22nd 2020, 17:52 |
ricksaccous |
ok... |
# |
Jan 22nd 2020, 17:50 |
jslamka5685 |
messaging between two users |
# |
Jan 22nd 2020, 17:50 |
jslamka5685 |
It is to display a conversation |
# |
Jan 22nd 2020, 17:50 |
ricksaccous |
@jslamka5685 this is the problem you are trying to solve right? |
# |
Jan 22nd 2020, 17:49 |
ricksaccous |
are you wanting to reverse them because of possible nulls? |
# |
Jan 22nd 2020, 17:49 |
ricksaccous |
.... |
# |
Jan 22nd 2020, 17:49 |
mark.mikkelson |
couldn't you just use ?sort=dateanddirection=desc |
# |
Jan 22nd 2020, 17:40 |
jslamka5685 |
How can I reverse the item order in a pagintor object? |
# |
Jan 22nd 2020, 17:39 |
jslamka5685 |
To do this, I believe I need to select records in descending order and then reverse them |
# |
Jan 22nd 2020, 17:39 |
jslamka5685 |
When working with Cake3x paginator, I am looking to get the latest records in ASC order. |
# |
Jan 22nd 2020, 17:25 |
slackebot |
my end point ( /tickets/update ) . I have this in my routes.php : `Router::scope('/tickets', function (RouteBuilder $routes) {` `});` |
# |
Jan 22nd 2020, 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 2020, 17:19 |
matt |
thanks for helping guys |
# |
Jan 22nd 2020, 17:18 |
matt |
deleting the table i felt was a good approch |
# |
Jan 22nd 2020, 16:33 |
neon1024 |
..and allows easier re-indexing |
# |
Jan 22nd 2020, 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 2020, 16:26 |
ricksaccous |
that's what i tend to do |
# |
Jan 22nd 2020, 16:26 |
ricksaccous |
after that use logic to refill the data if the data is necessary |
# |
Jan 22nd 2020, 16:26 |
ricksaccous |
destroy the table in a migration and recreate it |
# |
Jan 22nd 2020, 16:25 |
ricksaccous |
when trying to change the primary key to another column it's usually not worth it |
# |
Jan 22nd 2020, 16:25 |
matt |
i think it worked but when it tried to backfill the table it sets all to 0 |
# |
Jan 22nd 2020, 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 2020, 16:24 |
ndm |
https://book.cakephp.org/phinx/0/en/migrations.html#working-with-foreign-keys |
# |
Jan 22nd 2020, 16:24 |
matt |
will try that |
# |
Jan 22nd 2020, 16:23 |
ndm |
So there's a foreign key constraint that you need to drop first |
# |
Jan 22nd 2020, 16:23 |
matt |
gives me this error |
# |
Jan 22nd 2020, 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 2020, 16:22 |
ndm |
Also what does "doesn't work" mean exactly? |
# |
Jan 22nd 2020, 16:22 |
ndm |
Have you changed your respective CakePHP table class accordingly too? |
# |
Jan 22nd 2020, 16:21 |
matt |
doesnt work |
# |
Jan 22nd 2020, 16:21 |
matt |
i tried this |
# |
Jan 22nd 2020, 16:21 |
matt |
``` $table->addColumn('id','integer', [ 'length' => 11, 'null' => false, 'default' => null, ]); $table->changePrimaryKey(['id']);``` |
# |
Jan 22nd 2020, 16:20 |
ndm |
@matt There's the `changePrimaryKey()` method: https://book.cakephp.org/phinx/0/en/migrations.html#changing-the-primary-key |
# |
Jan 22nd 2020, 16:15 |
matt |
```attendees(id,member_id,occ_id) - new table``` |
# |
Jan 22nd 2020, 16:15 |
em |
That could clarify this situation a little bit i think |
# |
Jan 22nd 2020, 16:15 |
matt |
```attendees(member_id,occ_id) - old table``` |
# |
Jan 22nd 2020, 16:14 |
matt |
i need the new primary key to be a 'id' column |
# |
Jan 22nd 2020, 16:14 |
matt |
How do i change the primary key of table that was earlier using a composite key from a migration? |
# |
Jan 22nd 2020, 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 2020, 16:12 |
ndm |
You're welcome |
# |
Jan 22nd 2020, 16:10 |
em |
@ndm now i see that isEmptyAllowed() has no data parameter at all :) And i got about custom validation, Thank you :) |