# |
Dec 21st 2017, 14:44 |
neon1024 |
Unless perhaps the core framework return types don’t match |
# |
Dec 21st 2017, 14:44 |
neon1024 |
I’m curious why it thinks it can be an array when it’s a $query = $this->Examples->find() |
# |
Dec 21st 2017, 14:43 |
neon1024 |
` 59 Parameter #1 $object of method Cake\Controller\Controller::paginate() expects Cake\ORM\Query|Cake\ORM\Table|string|null, array|Cake\ORM\Query given.` |
# |
Dec 21st 2017, 14:43 |
neon1024 |
This is an odd one from phpstan |
# |
Dec 21st 2017, 14:40 |
neon1024 |
So I need to loop my query and assign each one?! |
# |
Dec 21st 2017, 14:39 |
neon1024 |
As `withData($name, $value)` |
# |
Dec 21st 2017, 14:39 |
neon1024 |
How do I update this to match 3.4+? `$this->request->data = $this->request->query;` |
# |
Dec 21st 2017, 14:39 |
dosjota |
someone has used environment variables ?? |
# |
Dec 21st 2017, 14:25 |
dosjota |
someone has used environment variables |
# |
Dec 21st 2017, 14:24 |
dosjota |
Hi!! |
# |
Dec 21st 2017, 13:16 |
Leonardo_0112 |
products -> returns 'Product 02' products?page=2 -> returns 'Product 02' products?page=3 -> returns 'Product 03' |
# |
Dec 21st 2017, 13:16 |
Leonardo_0112 |
$this->Paginator->settings['limit'] = 1; $this->Paginator->settings['offset'] = 1; |
# |
Dec 21st 2017, 13:12 |
Leonardo_0112 |
Hi! In my CakePHP 2 project I'm paginating my products. In the Controller I've set $this->Paginator->settings['offset'] = 1. In the first page, the 'offset' works (skipping the first product), but in second page the 'offset' seems not working, resulting in a repeated product. Any ideia how can I make it work? |
# |
Dec 21st 2017, 12:59 |
jkpatel291289 |
how should is dispalt statename in inddex.ctp view? |
# |
Dec 21st 2017, 12:59 |
jkpatel291289 |
$this->paginate['contain'] = ['States']; |
# |
Dec 21st 2017, 12:58 |
jkpatel291289 |
$this->paginate['fields'] = [ 'Customers.id', 'Customers.name', 'States.name', 'Customers.contact_number', ]; |
# |
Dec 21st 2017, 12:46 |
obinoob |
johan me too but it might be on this specific version not sure lol |
# |
Dec 21st 2017, 12:45 |
obinoob |
neon1024 definitely mysql version ;) |
# |
Dec 21st 2017, 12:45 |
johan |
I guess the simple answer is: don't do it. |
# |
Dec 21st 2017, 12:45 |
johan |
I can remember "ON UPDATE CURRENT_TIMESTAMP" being on multiple columns in the same table being a problem as far back as MySQL 5.5, maybe even before that. |
# |
Dec 21st 2017, 12:44 |
neon1024 |
Perhaps a different version of MySQL. I know that 5.7 made some updates to GROUP BY to make it more strict and inline with “proper databases”, so perhaps there are other changes |
# |
Dec 21st 2017, 12:40 |
obinoob |
yes I agree however I'm pretty sure I've done exactly the same before in many tables... |
# |
Dec 21st 2017, 12:39 |
neon1024 |
Sounds pretty explanatory |
# |
Dec 21st 2017, 12:38 |
obinoob |
neon1024 I've removed the timestamp(0) param but mysql still complain for ERROR 1293 (HY000): Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause |
# |
Dec 21st 2017, 12:38 |
neon1024 |
Oh right |
# |
Dec 21st 2017, 12:37 |
obinoob |
neon1024 not exactly a problem, I'm just trying to establish mysql default behaviour in fact it's not a problem for cakephp I guess :) anyway I think it's more related with mysql version... |
# |
Dec 21st 2017, 12:24 |
neon1024 |
obinoob, You’ve added one? What’s wrong with the Timestamp behaviour? Or, I should say, how does your use-case differ? Perhaps there is an enhancement possible with the Timestamp behaviour |
# |
Dec 21st 2017, 12:24 |
johan |
Sup David :slightly_smiling_face: |
# |
Dec 21st 2017, 12:23 |
neon1024 |
Heya @johan |
# |
Dec 21st 2017, 12:20 |
obinoob |
johan yes I agree I've added a behaviour for created and updated actions |
# |
Dec 21st 2017, 12:20 |
johan |
In fact, you probably don't even need it for `created`. |
# |
Dec 21st 2017, 12:19 |
johan |
In that case I'd remove the `ON UPDATE CURRENT_TIMESTAMP` part from the `updated`'s declaration. The Cake behaviour should be taking care of that for you anyway :slightly_smiling_face: |
# |
Dec 21st 2017, 12:18 |
obinoob |
johan yes and I get this ERROR 1293 (HY000): Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause |
# |
Dec 21st 2017, 12:17 |
obinoob |
not entirely sure but I think it's due to the timestamp syntax right? |
# |
Dec 21st 2017, 12:17 |
johan |
Have you tried just using TIMESTAMP instead of TIMESTAMP(0) ? |
# |
Dec 21st 2017, 12:16 |
obinoob |
this is the sql https://gist.github.com/obinoob/efd29cc4dc15a0c4aa553e4b8a3eafa6 |
# |
Dec 21st 2017, 12:16 |
obinoob |
hi, I'm getting the following error while alter database. ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(0) NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `active`, ADD COLUMN `updated` TIME' at line 2 |
# |
Dec 21st 2017, 11:22 |
neon1024 |
I must remember that processing a remote sites HTML using PHP domDocument is a real pain in the ass :( |
# |
Dec 21st 2017, 10:58 |
neon1024 |
:thumbsup: |
# |
Dec 21st 2017, 10:58 |
jotpe |
works perfect, thanks @neon1024 |
# |
Dec 21st 2017, 10:57 |
neon1024 |
Or you can just add the symlink command to your composer post install scripts |