Log message #4171912

# At Username Text
# Dec 31st 2018, 13:34 k4t ad this is the reason of exception
# Dec 31st 2018, 13:34 k4t ‌array ( 'Users.id' => 'admin', )
# Dec 31st 2018, 13:33 k4t it is adding always additional where condition to the query even if custom finder is used
# Dec 31st 2018, 13:33 k4t $query->where([current($query->aliasField($repository->getPrimaryKey())) => $id]);
# Dec 31st 2018, 13:32 k4t by
# Dec 31st 2018, 13:32 k4t ok, tis is caused by FindMethodTrait
# Dec 31st 2018, 11:31 admad in your custom finder overwrite existing where() conditions
# Dec 31st 2018, 11:29 admad follow the stack trace and find the relevant crud code
# Dec 31st 2018, 11:28 k4t no, it is string
# Dec 31st 2018, 11:27 challgren Is your ID integer?
# Dec 31st 2018, 11:27 k4t I did not found yet why Integer is used
# Dec 31st 2018, 11:27 k4t function
# Dec 31st 2018, 11:27 k4t checkNumeric
# Dec 31st 2018, 11:27 k4t \cakephp\cakephp\src\Database\Type\IntegerType.php
# Dec 31st 2018, 11:26 admad check the stack trace and figure out what exactly triggers the exception
# Dec 31st 2018, 11:25 k4t did not figure out solution yet
# Dec 31st 2018, 11:25 k4t probably caused because now instead of id:integer i am passing string
# Dec 31st 2018, 11:24 k4t but now I am getting exception: Cannot convert value of type `string` to integer
# Dec 31st 2018, 11:23 admad yeah can also use custom find method
# Dec 31st 2018, 11:23 slackebot <k4t>
# Dec 31st 2018, 11:23 k4t with route:
# Dec 31st 2018, 11:22 k4t this is what I tried
# Dec 31st 2018, 11:22 slackebot <k4t>
# Dec 31st 2018, 11:22 admad `view ($slug) { $this->Crud->on('beforeFind', function () {..}); $this->Crud->execute() }`
# Dec 31st 2018, 11:21 admad you could also use plugin's ViewAction and use Crud.beforeFind() event to modify the query in your controller action
# Dec 31st 2018, 11:19 k4t ok
# Dec 31st 2018, 11:18 admad or uses urls like /view/<id>/<slug> in which case you only have to setup route
# Dec 31st 2018, 11:15 admad you would have to make your own action classes or extend and modify existing ones
# Dec 31st 2018, 11:13 k4t hi @admad could you give me some hints how I can use slugs instead of id for view action (with CRUD plugin)?
# Dec 31st 2018, 10:55 bobby_1120 thanx and Happy New Year
# Dec 31st 2018, 10:55 bobby_1120 commit was missing, wrong properties into dbeaver
# Dec 31st 2018, 10:54 bobby_1120 I figured it out
# Dec 31st 2018, 10:51 challgren There’s like zero docs in book.cakephp.org about RegistryInteface::exists()
# Dec 31st 2018, 10:42 dereuromark you could also just do a normal find() or even find()->count()
# Dec 31st 2018, 10:42 dereuromark yeah, passing the id is pointless in this case
# Dec 31st 2018, 10:42 bobby_1120 :/
# Dec 31st 2018, 10:42 bobby_1120 but I try to check if any records is 1 for column is_admin
# Dec 31st 2018, 10:40 challgren $this->Users->exists([‘id’ => $id, ‘is_admin’ => 1]);
# Dec 31st 2018, 10:39 bobby_1120 https://thepasteb.in/p/vghO1EklqLWu3
# Dec 31st 2018, 10:37 challgren Why arent you passing an id along in the exists?
# Dec 31st 2018, 10:36 bobby_1120 yes