# |
Jul 17th 2019, 07:35 |
koeller |
Hi everyone, I have a question regarding the friendsofcake/CRUD plugin. I'm doing a simple delete and try to redirect to index, so that the response of the request would be a list of all items for logged user. I'm using JWT as Authentication method. Reading this:https://crud.readthedocs.io/en/latest/actions/delete.html#crud-beforeredirect I thought, it should automatically redirect to index, but it won't. So I tried to manually redirect in |
# |
Jul 17th 2019, 07:35 |
dereuromark |
use Search plugin for this |
# |
Jul 17th 2019, 07:34 |
h.mavisakalian |
What am I doing wrong? |
# |
Jul 17th 2019, 07:34 |
h.mavisakalian |
But it doesn’t work |
# |
Jul 17th 2019, 07:34 |
h.mavisakalian |
$query = $this->Users->find(‘all’,[ ‘conditions’ => $searchArray, ‘order’ => [‘Users.id’ => ‘ASC’] ]); |
# |
Jul 17th 2019, 07:33 |
h.mavisakalian |
Now I want to search the database this way |
# |
Jul 17th 2019, 07:33 |
h.mavisakalian |
I created an array from a search query with all values using exlode(’ ’, $searchValue); |
# |
Jul 17th 2019, 07:31 |
h.mavisakalian |
Good morning everyone. I have a question about search queries in CakePHP 3.X |
# |
Jul 17th 2019, 07:25 |
aivaras.godliauskas |
here you can set conditions |
# |
Jul 17th 2019, 07:25 |
aivaras.godliauskas |
``` class ArticlesTable extends Table { public function initialize(array $config) { $this->hasMany('Comments') ->setConditions(['approved' => true]); $this->hasMany('UnapprovedComments', [ 'className' => 'Comments' ]) ->setConditions(['approved' => false]) ->setProperty('unapproved_comments'); } } ``` |
# |
Jul 17th 2019, 07:25 |
aivaras.godliauskas |
https://book.cakephp.org/3.0/en/orm/associations.html#default-association-conditions |
# |
Jul 17th 2019, 07:24 |
neon1024 |
I need gmp, sodium and intl |
# |
Jul 17th 2019, 07:24 |
neon1024 |
Anyone know where I can find package names for PHP extension for Debian Fastly? |
# |
Jul 17th 2019, 07:23 |
aivaras.godliauskas |
Hi @neon1024 Fun fact im useing n3on as my nic |
# |
Jul 17th 2019, 07:23 |
felix.robaglia |
I'd be curious how ! I'm an intern and have a lot to learn @aivaras.godliauskas ^^ How can I say it directly in the table ? |
# |
Jul 17th 2019, 07:23 |
neon1024 |
Morning all :wave: |
# |
Jul 17th 2019, 07:23 |
aivaras.godliauskas |
or you can try and use some kind of soft delete for example https://github.com/UseMuffin/Trash |
# |
Jul 17th 2019, 07:23 |
neon1024 |
I quite like creating my own query and passing it to the Paginator :slightly_smiling_face: |
# |
Jul 17th 2019, 07:22 |
aivaras.godliauskas |
if you want to do it right way you can add this condition in table itself, where realiation is defined |
# |
Jul 17th 2019, 07:22 |
admad |
no. read up about custom finders on manul |
# |
Jul 17th 2019, 07:22 |
felix.robaglia |
Like a method i'll put in my AppController admad? |
# |
Jul 17th 2019, 07:22 |
felix.robaglia |
Wow, thanks a lot, I must be blind then cause it has to be in the doc ! Ty guys ! |
# |
Jul 17th 2019, 07:22 |
admad |
also a cleaner way would be to make a custom finder for that |
# |
Jul 17th 2019, 07:21 |
admad |
or use `conditions` like that :slightly_smiling_face: |
# |
Jul 17th 2019, 07:21 |
aivaras.godliauskas |
@felix.robaglia you can go ``` $this->paginate = [ 'contain' => ['Contracts'=>[ 'conditions'=>['delete IS'=>null] ] ] ]; ``` i believe |
# |
Jul 17th 2019, 07:21 |
admad |
@felix.robaglia `['contain' => ['Contracts' => function ($q) { $q->where(...)}]` |
# |
Jul 17th 2019, 07:19 |
felix.robaglia |
But I would like to only get contracts that have NULL in their 'deleted' column. I'm sorry if that's a dumb question or anything, but I did read the doc and i'm still stuck ! Thanks :slightly_smiling_face: |
# |
Jul 17th 2019, 07:19 |
felix.robaglia |
``` $this->paginate = [ 'contain' => ['Contracts'] ]; ``` |
# |
Jul 17th 2019, 07:19 |
felix.robaglia |
Hello, I'm discovering hasMany relations and i'm stuck on something I guess is really easy. I have a clients table, and it hasMany contracts. So I use this piece of code to retrieve contracts in my Clients Controller : |
# |
Jul 17th 2019, 07:18 |
maymeow |
After i run i18n extract on plugin i have problem with `The "_cake_core_" cache configuration does not exists.` what now? |
# |
Jul 17th 2019, 01:38 |
niel45 |
I'm gguessing that would depend on what you are using as the Authenticator. If you have used your own User class you would reset the password via that I'm guessing. I have not implemented it yet myself. |
# |
Jul 17th 2019, 01:06 |
geoff |
anybody here have experience with the new authentication plugin? i'm having a hard time finding any instructions on how to reset a user's password. i'm sure it's simple, and i'm missing something very easy and i'll feel _very_ dumb once somebody explains it to me... any tips? |
# |
Jul 16th 2019, 19:52 |
maymeow |
ill try |
# |
Jul 16th 2019, 19:45 |
challgren |
@maymeow for testing I would set at least 1 migration to be a break point and see if -t 0 does all of them or to the first break point |
# |
Jul 16th 2019, 19:44 |
maymeow |
yes i know but in this db is everything created only via Migrations |
# |
Jul 16th 2019, 19:43 |
niel45 |
rollback only works for table you have created via Migrations. Any thing existing before that isn't touched. |
# |
Jul 16th 2019, 19:41 |
maymeow |
ill try what said @ricksaccous... i think `bin/cake migrations rollback -t 0` will work for me |
# |
Jul 16th 2019, 19:41 |
maymeow |
yes @niel45... something like `php artisan migrate:refresh` in laravel. When i post changes to app they will go to CI and are deployed to review |
# |
Jul 16th 2019, 19:40 |
niel45 |
if so, there is a method from Phinx that will check for a table exiting. I've used it for exactly that |
# |
Jul 16th 2019, 19:38 |
niel45 |
@maymeow, are you asking how to drop tables if they exist, before creating them in a migration? |
# |
Jul 16th 2019, 19:37 |
challgren |
Couldn’t you write a shell to truncate the tables for you? and then run all the migrations? |