# |
Dec 2nd 2017, 21:38 |
ludger.a |
What puzzles me is that both the mathing and notMatching parts work if they are alone (matching gives me alle Periods of Competitions the User is interested in; notMatching gives me all Periods the User has not yet participated in), but together the "matching" part seems to get ignored and I the same resulst as if I only had the notMatching part... |
# |
Dec 2nd 2017, 21:35 |
slackebot2 |
period). Now I want to find all Periods, which belong to a Competition the User is interested in, but only these Periods which the User hasn't yet partitipated in. |
# |
Dec 2nd 2017, 21:35 |
ludger.a |
File uploaded https://cakesf.slack.com/files/U89T82T39/F88R3BQJE/-.txt / https://slack-files.com/T053DPNCM-F88R3BQJE-245d06d72b - I am fighting with a relative complicated query. I have 3 models: Users, Competitions and Periods. Uandlt;-belongsTo-andgt;C (meaning, user is interested in the competition) C -hasMany-andgt; P (at these periods one can take part in the competition) and U andlt;-belongsTo-andgt; P (the user has already partitipated at this |
# |
Dec 2nd 2017, 21:26 |
obinoob |
can somebody explain to me what the problem is please? |
# |
Dec 2nd 2017, 21:25 |
saeideng |
@dereuromark you are here |
# |
Dec 2nd 2017, 21:10 |
obinoob |
I'm not getting what the problem is really?!? |
# |
Dec 2nd 2017, 21:08 |
obinoob |
this is the debug of entity before patch and after patch: https://gist.github.com/obinoob/0263a08cb870dec10a902b7c217c1efe |
# |
Dec 2nd 2017, 21:03 |
saeideng |
:+1: |
# |
Dec 2nd 2017, 21:03 |
saeideng |
@dereuromark I think you are right |
# |
Dec 2nd 2017, 20:26 |
obinoob |
hello :) |
# |
Dec 2nd 2017, 20:25 |
saeideng |
hi |
# |
Dec 2nd 2017, 20:24 |
obinoob |
I've debugged the entity and the values are in fact being pulled out of the database... because they are filling the form just fine! The problem is that they are being treated has new registries please take a look at the entity debug https://gist.github.com/obinoob/0263a08cb870dec10a902b7c217c1efe |
# |
Dec 2nd 2017, 20:13 |
obinoob |
dereuromark but you're right emails and phones are not being pull out of the database however contain has emails and phones as conditions?!? |
# |
Dec 2nd 2017, 20:05 |
obinoob |
Another thing I see is that errors is empty but the validator message if firing '=( |
# |
Dec 2nd 2017, 20:04 |
obinoob |
*how entities |
# |
Dec 2nd 2017, 20:03 |
obinoob |
dereuromark yes I see but I don't have that deep understanding of entities work at that level seriously :( I get that the registry is not being pulled out of the database it looks like I'm adding a new registry the strange part is that it's not complaining about Addresses and it surely is at the same level as Phones or Emails... |
# |
Dec 2nd 2017, 19:59 |
dereuromark |
you might not need it, just make sure you pull the related records so patching updates those instead of creating new ones. |
# |
Dec 2nd 2017, 19:58 |
obinoob |
dereuromark I've come across "dirty" but I don't have the slightest idea |
# |
Dec 2nd 2017, 19:57 |
dereuromark |
I did some manual looping for my part to work out: https://pastebin.com/fQv0PSVR - Also the $capability->setDirty('features', true); in my case helped :slightly_smiling_face: |
# |
Dec 2nd 2017, 19:56 |
obinoob |
dereuromark I can't find any documented example ... |
# |
Dec 2nd 2017, 19:55 |
dereuromark |
I think you need to use contain to get the related records as well, for patching |
# |
Dec 2nd 2017, 19:55 |
dereuromark |
I had a similar issue when importing csv multiple times |
# |
Dec 2nd 2017, 19:54 |
obinoob |
anyone? |
# |
Dec 2nd 2017, 19:46 |
obinoob |
What can I do in order to update all the association? Because it looks like I'm adding a new registry... |
# |
Dec 2nd 2017, 19:45 |
obinoob |
hello, I been fighting hasMany association for a couple of day now, I can add / delete / list but not update! Validation rules keep firing errors "already in database" for Phones and Emails... https://gist.github.com/obinoob/e72c43d61875a0576c0ee97e121a44ef |
# |
Dec 2nd 2017, 12:27 |
angelxmoreno |
@dereuromark I will check the form helper class sir |
# |
Dec 2nd 2017, 06:07 |
admad |
make the users relogin or implement refresh tokens yourself :slightly_smiling_face: |
# |
Dec 2nd 2017, 04:23 |
prepender |
how do you guys handle expired jwt tokens on mobile apps? do you store their login credentials to refresh the token? i notice most out of the box jwt token solutions dont have resfresh endpoints and I wonder what the assumed method of refreshing would be? |
# |
Dec 2nd 2017, 01:58 |
dereuromark |
angel: did you solve it? passing the form into the formhelper should help, that uses its schema |
# |
Dec 2nd 2017, 00:03 |
obinoob |
back tomorrow have a good night/day to you all cheers :) |
# |
Dec 1st 2017, 23:47 |
obinoob |
I could unsetProperty I guess but not sure how with mass assignment https://github.com/cakephp/cakephp/issues/4288 |
# |
Dec 1st 2017, 23:42 |
phantomwatson |
The SQL statement `DELETE FROM phones WHERE number IS NULL` should do it. |
# |
Dec 1st 2017, 23:40 |
phantomwatson |
But concerning the unwanted database records, you'll need to either remove those manually or write a script that searches through the database and removes them. Just changing CakePHP's validation rules and form-processing logic won't automatically change any existing records in the database. |
# |
Dec 1st 2017, 23:38 |
phantomwatson |
Then to be safe, have some server-side logic that checks that data and returns an error if no phone numbers have been entered. This is just in case the client-side validation fails. |
# |
Dec 1st 2017, 23:36 |
phantomwatson |
You want to make the first phone number field required but not the second one? You'll likely need to make _neither_ of them required in your validation rules, then manually set `$this->Form->control('number', ['required' => true]);` for your first phone number input field. |
# |
Dec 1st 2017, 23:34 |
obinoob |
sorry method :) |
# |
Dec 1st 2017, 23:34 |
obinoob |
? It makes no sense to me that cake has no such future.... |
# |
Dec 1st 2017, 23:34 |
obinoob |
phantomwatson I've found that public function beforeSave method is not triggered from controller but from table... the problem is that beforeSave($event, $entity, $options) { ... } in table has access at one entity at a time, not to all of the entities.... also how can I mark only one phone number as obligatory without refactoring the all database |
# |
Dec 1st 2017, 23:24 |
phantomwatson |
*Answering my own question:* Turns out I should have been using `$this->request->getEnv('FOO')` to read the variable instead of `env('FOO')`. |
# |
Dec 1st 2017, 23:07 |
d-fens |
why doesn't the baked code order by id , iirc that was default in older versions? |
# |
Dec 1st 2017, 23:04 |
phantomwatson |
I'm avoiding `configRequest()` to stay DRY and avoid having to duplicate the other environment variables that are set in this test class's `setUp()` method. |