# |
Jun 19th 2018, 15:07 |
mari_ |
and updated the app.default.php with this: 'Session' => [ 'defaults' => 'database' ] |
# |
Jun 19th 2018, 15:06 |
mari_ |
i created the database table liuke this: CREATE TABLE `sessions` ( `id` char(40) CHARACTER SET ascii COLLATE ascii_bin PRIMARY KEY, `created` datetime DEFAULT CURRENT_TIMESTAMP, -- Optional `modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- Optional `data` blob DEFAULT NULL, -- for PostgreSQL use bytea instead of blob `expires` int(10) unsigned DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
# |
Jun 19th 2018, 15:06 |
mari_ |
i have troubles understanding the chapter with database sessions on cakephp 3.6 |
# |
Jun 19th 2018, 15:05 |
mari_ |
hi all! |
# |
Jun 19th 2018, 14:40 |
birdy247 |
If saving to a join table, that is using "cake magic", whats the best way to validate at least 1 is selected |
# |
Jun 19th 2018, 14:29 |
kaliel |
ok, what's important is that i get my results, i'll dig into it to try the same with a single query |
# |
Jun 19th 2018, 14:28 |
kaliel |
erro :slightly_smiling_face: |
# |
Jun 19th 2018, 14:27 |
neon1024 |
Just call `->first()` after the `->where()` I think |
# |
Jun 19th 2018, 14:27 |
kaliel |
but is there a way for "contain" to return a single entity instead of array ? |
# |
Jun 19th 2018, 14:27 |
neon1024 |
:thumbsup: |
# |
Jun 19th 2018, 14:26 |
kaliel |
File uploaded https://cakesf.slack.com/files/U38NH0S01/FB9ULC4AG/-.php / https://slack-files.com/T053DPNCM-FB9ULC4AG-80c5c7a040 - <@U1BT622HW> thanks to your advices, now get it working like this : |
# |
Jun 19th 2018, 14:19 |
neon1024 |
Bad times yo |
# |
Jun 19th 2018, 14:19 |
neon1024 |
Just don’t use a custom header like I did |
# |
Jun 19th 2018, 14:18 |
LubosR |
mikesmoniker use https://github.com/ADmad/cakephp-jwt-auth |
# |
Jun 19th 2018, 14:18 |
neon1024 |
I wrote my own for our web service |
# |
Jun 19th 2018, 14:18 |
neon1024 |
I would recommend using Bearer token auth and your own Auth adapter |
# |
Jun 19th 2018, 14:17 |
mikesmoniker |
Is it possible to use Cake’s build in basic auth functionality w/ just a username or password (i.e. an “api token”) through configuration or would I need to write my own version of the auth component? |
# |
Jun 19th 2018, 14:12 |
neon1024 |
Perhaps it just needs `return $query->where(['Bids.prix' => $query->func()->max('Bids.prix')]);` ? |
# |
Jun 19th 2018, 14:11 |
kaliel |
@neon1024 Thanks, but it didn't do the trick :S |
# |
Jun 19th 2018, 14:11 |
neon1024 |
Why is it that when I post to my method, which has `$this->getRequest()->allowMethod('post');` I get a Method Not Allowed exception?! I’m using the correct method |
# |
Jun 19th 2018, 14:08 |
LubosR |
Was thinking that problem could be with foreign keys and/or indexes, but checked and I did not set offer_type_id as foreign key neither index |
# |
Jun 19th 2018, 14:07 |
LubosR |
I am messy when trying to quickly solve :) but good piont :) |
# |
Jun 19th 2018, 14:06 |
neon1024 |
That’s my excuse anyway :P |
# |
Jun 19th 2018, 14:06 |
neon1024 |
Ah well, no idea. Your code is pretty messy, so it’s hard to follow |
# |
Jun 19th 2018, 14:05 |
neon1024 |
Unless you use it’s original value elsewhere of course |
# |
Jun 19th 2018, 14:05 |
neon1024 |
Btw you can replace all that offerType combine with just find(‘list’) |
# |
Jun 19th 2018, 14:05 |
LubosR |
With this migration script I am trying to avoid associations |
# |
Jun 19th 2018, 14:04 |
neon1024 |
In your database |
# |
Jun 19th 2018, 14:04 |
neon1024 |
So you have offers.offer_type_id right? |
# |
Jun 19th 2018, 14:04 |
neon1024 |
You’re in Offers |
# |
Jun 19th 2018, 14:04 |
LubosR |
And value = 4 which is never saved :( |
# |
Jun 19th 2018, 14:04 |
LubosR |
Checked DB field type and it is integer, same what I am passing into entity |
# |
Jun 19th 2018, 14:03 |
LubosR |
Nope, as you might see at the image, there is 'offer_type_id' => (int) 4 |
# |
Jun 19th 2018, 14:03 |
neon1024 |
Could just be that the value you’re trying to write is empty |
# |
Jun 19th 2018, 14:02 |
LubosR |
In case anyone else want to help me to solve this puzzle, here is my debugging screenshot https://pasteboard.co/HqCHmKh.png (code, debug output, sql output = with no offer_type_id!!) |
# |
Jun 19th 2018, 13:56 |
LubosR |
neon1024 thanks for discussion, i tried again with patchEntity and checking errors, isDirty and even when all looks good it is not saved. Have to leave it open for now, but what a mystery, right? :) |
# |
Jun 19th 2018, 13:56 |
neon1024 |
File uploaded https://cakesf.slack.com/files/U1BT622HW/FB9JEFW3B/find_bids_by_maximum_price.php / https://slack-files.com/T053DPNCM-FB9JEFW3B-27d07b5c15 |
# |
Jun 19th 2018, 13:55 |
neon1024 |
I don’t think this will work, but first attempt |
# |
Jun 19th 2018, 13:55 |
tierrarara |
slackebot - cakebot3 thanks for your answer |
# |
Jun 19th 2018, 13:45 |
kaliel |
I'm stuck from hours on the last part (subquery) |
# |
Jun 19th 2018, 13:44 |
kaliel |
File uploaded https://cakesf.slack.com/files/U38NH0S01/FBA1SCJ1Z/-.sql / https://slack-files.com/T053DPNCM-FBA1SCJ1Z-62c9be32f5 |