# |
Oct 10th 2018, 01:57 |
blancessanchez30 |
good morning |
# |
Oct 9th 2018, 22:17 |
sdevore |
I use ‘hidden’ ;) |
# |
Oct 9th 2018, 22:13 |
rightscoreanalysis |
great thanks, I think it works now |
# |
Oct 9th 2018, 22:11 |
bmudda |
@rightscoreanalysis Yes according to the docs, that's correct. |
# |
Oct 9th 2018, 22:00 |
rightscoreanalysis |
in order to update |
# |
Oct 9th 2018, 22:00 |
rightscoreanalysis |
@bmudda so if Tags is my hasMany data do I need: echo $this->Form->control('tags.0.id'); |
# |
Oct 9th 2018, 21:58 |
bmudda |
https://book.cakephp.org/3.0/en/views/helpers/form.html#creating-inputs-for-associated-data |
# |
Oct 9th 2018, 21:58 |
rightscoreanalysis |
is Foo hasMany Bar, do I need to set Bar.id in the request data to update it? |
# |
Oct 9th 2018, 21:54 |
rightscoreanalysis |
is anyone here? |
# |
Oct 9th 2018, 21:51 |
rightscoreanalysis |
which is this happening? This is an update to an existing record |
# |
Oct 9th 2018, 21:50 |
rightscoreanalysis |
if I debug the patch entity i see: '[new]' => true, |
# |
Oct 9th 2018, 21:40 |
rightscoreanalysis |
no matter what it always tries to save new records which is wrong |
# |
Oct 9th 2018, 21:40 |
rightscoreanalysis |
https://gist.github.com/spacebiscuit/59a4ebbade0ea1e96f8b0a5faaf61735 |
# |
Oct 9th 2018, 21:40 |
rightscoreanalysis |
this is totally screwed up and I don't see anything wrong with this request data |
# |
Oct 9th 2018, 21:32 |
rightscoreanalysis |
https://book.cakephp.org/3.0/en/orm/saving-data.html#saving-hasmany-associations |
# |
Oct 9th 2018, 21:32 |
rightscoreanalysis |
the book's example is not in this format.... |
# |
Oct 9th 2018, 21:31 |
rightscoreanalysis |
I thought that hasMany data should be model.0.field |
# |
Oct 9th 2018, 21:22 |
rightscoreanalysis |
Is that enough? |
# |
Oct 9th 2018, 21:21 |
rightscoreanalysis |
$this->Form->input('id', ['type' => 'hidden', 'value' => $periodId]); |
# |
Oct 9th 2018, 21:21 |
rightscoreanalysis |
I am setting the id of the PropertyPeriod |
# |
Oct 9th 2018, 21:20 |
rightscoreanalysis |
in my case I am saving to PropertyPeriod whuch hasMany PropertyPrices |
# |
Oct 9th 2018, 21:19 |
bmudda |
@rightscoreanalysis ^ |
# |
Oct 9th 2018, 21:18 |
bmudda |
you wouldn’t have to worry about fk in that case |
# |
Oct 9th 2018, 21:18 |
bmudda |
if you’re always passing all the records (associated data) during update, you can use the `replace` strategy |
# |
Oct 9th 2018, 21:18 |
bmudda |
yes, if you don’t pass the fk, then it will insert it as a new record |
# |
Oct 9th 2018, 21:17 |
rightscoreanalysis |
@bmudda I think the issue might be that I am not passing the fk |
# |
Oct 9th 2018, 21:14 |
bmudda |
https://book.cakephp.org/3.0/en/orm/saving-data.html#saving-hasmany-associations |
# |
Oct 9th 2018, 21:14 |
bmudda |
@rightscoreanalysis The default save strategy for hasMany is `append`. So unless you provide the foreign key as part of the record (for the associated data), it will insert it as a new record. |
# |
Oct 9th 2018, 21:06 |
rightscoreanalysis |
When saving hasMany relations how can I ensure that I update existing records, in my case my save its creating duplicate records |
# |
Oct 9th 2018, 20:54 |
rightscoreanalysis |
i figure dit! |
# |
Oct 9th 2018, 20:49 |
rightscoreanalysis |
I have a hasMany relation, when I save the parent the hasMany data is not saving |
# |
Oct 9th 2018, 19:47 |
rightscoreanalysis |
that works but I should be able to achieve the same goal without the foreach |
# |
Oct 9th 2018, 19:47 |
rightscoreanalysis |
foreach($x as and$y) { $y = Hash::combine($y, '{n}.room_id', '{n}'); } |
# |
Oct 9th 2018, 19:47 |
rightscoreanalysis |
can anyone help me refine something |
# |
Oct 9th 2018, 19:35 |
zomb |
thanks@steini |
# |
Oct 9th 2018, 19:18 |
st.steinkuehler |
@zomb in my table class in method `validationDefault` I use something like this for regex validation: $validator->regex('code','/[0-9a-z]{6}/',__('Der URL-Code darf nur Kleinbuchstaben und Zahlen enthalten.')); see also https://api.cakephp.org/3.6/class-Cake.Validation.Validator.html#_regex |
# |
Oct 9th 2018, 18:11 |
kitcat711_ |
I use the .htaccess for some 301 redirection occasionnaly (a part of my app is a forum and I change some slugs from time to time for GG) |
# |
Oct 9th 2018, 18:10 |
kitcat711_ |
thanks |
# |
Oct 9th 2018, 16:25 |
admad |
and the url rewriting rules should go directly into your apache config if you have access to ti |
# |
Oct 9th 2018, 16:24 |
admad |
setting server's document root to `webroot` is what everyone SHOULD do |
# |
Oct 9th 2018, 15:38 |
josbeir |
it should not be in there. |