Log message #4181155

# At Username Text
# Mar 27th 2019, 20:57 ricksaccous i seee
# Mar 27th 2019, 20:57 rogerpro I want to save the hasMany entities that has changed (actually all of them in the entity passed to save() have changed).
# Mar 27th 2019, 20:56 rogerpro Why does `save()` not check diff in association entities? It’s for efficiency I guess, but I’m not sure it’s the best choice.
# Mar 27th 2019, 20:55 ricksaccous lol
# Mar 27th 2019, 20:55 ricksaccous is it a belongsToMany and you pretty much want it to be dirty on every save and save strategy is replace?
# Mar 27th 2019, 20:54 rogerpro I’m afraid it’s a feature, not a bug ,:) Anyhow, I guess I’m not the only one to forgot the use of `dirty()` method. An ORM should be as easy and magical as posible (whilst not inventing stuff).
# Mar 27th 2019, 20:53 bencayk I am new to cakephp;cakephp is installed,I want to add a test in create or modify; checking Date Of Birth (greater than 65 years old)
# Mar 27th 2019, 20:51 cnizzardini You should submit a bug report
# Mar 27th 2019, 20:45 rogerpro ^ I think we should do something for Cake 4 :thinking_face:
# Mar 27th 2019, 20:44 rogerpro I found a case where the ORM `save()` returns an entity with associations and does actually nothing :face_with_rolling_eyes: All changes were in associations and the solution is to set them `dirty`. But the fact that `save()` returns something and does nothing is confusing IMHO.
# Mar 27th 2019, 20:25 challgren Could also be that the hashed password is salted with something
# Mar 27th 2019, 20:24 andy-ttg thanks guys
# Mar 27th 2019, 20:24 andy-ttg cheers! I'll give it a go
# Mar 27th 2019, 20:23 andy-ttg Yes, I only want to delete the one record @ricksaccous I think that may work
# Mar 27th 2019, 20:22 ricksaccous @andy-ttg also saveStrategy doesn't necessary delete anything for you, it only replaces instead of appends if you specify that
# Mar 27th 2019, 20:21 ricksaccous @andy-ttg that would work wouldn't it?
# Mar 27th 2019, 20:20 ricksaccous i suppose you could just do $this->Model->Associated->delete($entity->associated);
# Mar 27th 2019, 20:20 cnizzardini ah i see
# Mar 27th 2019, 20:20 ricksaccous if you contain it and it gets hydrated
# Mar 27th 2019, 20:20 ricksaccous i don't think he cares to delete one after the other, he just wants to delete it from the other model, lol
# Mar 27th 2019, 20:20 cnizzardini But I assume it would work with hasOne
# Mar 27th 2019, 20:19 cnizzardini I know the example shown is for hasMany
# Mar 27th 2019, 20:19 cnizzardini Does cascading deletes not working?
# Mar 27th 2019, 20:18 andy-ttg i could get around it by deleting them straight up, but just thought I would ask if there was a more elegant solution
# Mar 27th 2019, 20:17 andy-ttg right, it's kinda of weird case
# Mar 27th 2019, 20:16 ricksaccous but i think you just want to clear the associated record
# Mar 27th 2019, 20:16 ricksaccous hasOne? kind of weird, i thought you meant delete one after you delete the other
# Mar 27th 2019, 20:16 ricksaccous oh wait
# Mar 27th 2019, 20:15 ricksaccous @andy-ttg foreign keys
# Mar 27th 2019, 20:12 cnizzardini https://book.cakephp.org/3.0/en/orm/deleting-data.html#cascading-deletes
# Mar 27th 2019, 20:12 cnizzardini Isn't there a cascade option on the Table class or something?
# Mar 27th 2019, 20:11 cnizzardini Ive never tried that before, i think ive always just manually issued the delete in that case
# Mar 27th 2019, 20:11 cnizzardini Ahh i see
# Mar 27th 2019, 20:10 andy-ttg oh, I'm sorry, I don't mean remove the association, I mean remove the associated row from the database
# Mar 27th 2019, 20:09 cnizzardini You can edit associations using TableRegistry
# Mar 27th 2019, 20:06 andy-ttg Is there a good way to remove a hasOne association through the first object? Like User hasOne Profile, and I want to remove the Profile by saving like `$this->User->save($data)`. I tried setting `$data->profile = null`, but that doesn't work. I wish there was a saveStrategy on hasOne associations like hasMany does.
# Mar 27th 2019, 20:02 cnizzardini where 1st arg is the submitted password and the 2nd argument is what is in the database
# Mar 27th 2019, 20:01 cnizzardini $hasher->check($this->request->getData('new_password'), $pwd->passphrase)
# Mar 27th 2019, 20:01 cnizzardini $hasher = new DefaultPasswordHasher();
# Mar 27th 2019, 20:01 cnizzardini If you are doing things the cake way I believe the correct way to do so is:
# Mar 27th 2019, 19:59 cnizzardini You are talking about this: https://www.php.net/manual/en/function.password-verify.php ?