# |
Apr 29th 2017, 11:58 |
slackebot1 |
crud for table param. [cake bake all param] No effect. Same results. Now, since param_id and id follow CakePHP conventions, I tried this: $this->belongsTo('param'); ERROR: THE USER COULD NOT BE SAVED $this->belongsTo('Params'); ERROR: TABLE PARAMS DOES NOT EXIST $this-belongsTo('anythingelse'); DOES NOT SAVE param.ADDRESS1 |
# |
Apr 29th 2017, 11:58 |
loginews |
@admad Regarding : https://gist.github.com/loginews/78dbc099fe1689332c299002d361f472> $this->belongsTo('param')->setForeignKey('id')->setProperty('param_id'); DOES NOT SAVE param.ADDRESS1 $this->belongsTo('anythingelse')->setForeignKey('id')->setProperty('param_id'); DOES NOT SAVE param.ADDRESS1 $this->belongsTo('Params')->setForeignKey('id')->setProperty('param_id'); DOES NOT SAVE param.ADDRESS1 I had not yet baked a crud for table param |
# |
Apr 29th 2017, 11:42 |
chris-andre |
Good :slightly_smiling_face: |
# |
Apr 29th 2017, 11:41 |
saeideng |
worked well |
# |
Apr 29th 2017, 11:40 |
chris-andre |
Try allowEmpty |
# |
Apr 29th 2017, 11:40 |
saeideng |
cake 3.4.x |
# |
Apr 29th 2017, 11:39 |
saeideng |
receive "This field cannot be left empty" error |
# |
Apr 29th 2017, 11:39 |
saeideng |
i can send image to server but |
# |
Apr 29th 2017, 11:38 |
saeideng |
//$validator //->requirePresence('image', 'create') //->notEmpty('image') // ; |
# |
Apr 29th 2017, 11:37 |
saeideng |
i want to disable validator empty for image input |
# |
Apr 29th 2017, 11:20 |
metoyoko |
Hi @admad is setTable and className are the same? thanks |
# |
Apr 29th 2017, 11:18 |
metoyoko |
@dereuromark thanks |
# |
Apr 29th 2017, 11:16 |
loginews |
sorry... I can't help being a grumpy old man! brb |
# |
Apr 29th 2017, 11:14 |
admad |
If the 2 are not associated in any way then there's no business modifying those values together. Unless there's some association between the 2 models ORM can't save them in a single save() call. |
# |
Apr 29th 2017, 11:13 |
loginews |
@admad in fact the 2 tables are not linked in any way! I created a link to please Cake !!! :slightly_smiling_face: |
# |
Apr 29th 2017, 11:11 |
loginews |
I will go and correct that and come back asap. |
# |
Apr 29th 2017, 11:11 |
loginews |
no... let me explain. Param contains standard parameters, (a single record) and I want (for instance) to allow the user to change his own parameters, and also some system parameters at the same time. I don't want to create two input screens for that, one for the user's profile parameters, and another for the overall system parameters. Users don't understand systems. |
# |
Apr 29th 2017, 11:08 |
admad |
Are you sure you need Users belongsTo Params? I would have guess a user has multiple params hence Users hasMany Params |
# |
Apr 29th 2017, 11:08 |
loginews |
ok... let me try to correct that. |
# |
Apr 29th 2017, 11:08 |
admad |
Since your db table isn't plural as per convention just use $this->setTable('param'); in the ParamsTable class. |
# |
Apr 29th 2017, 11:07 |
admad |
it is kinda. But model names start with caps, so should be "Params" and also the model name should be plural as per conventions |
# |
Apr 29th 2017, 11:05 |
loginews |
is this not an association? $this->belongsTo('param')->setForeignKey('id')->setProperty('param_id'); |
# |
Apr 29th 2017, 11:04 |
loginews |
let me check |
# |
Apr 29th 2017, 11:04 |
loginews |
hmm |
# |
Apr 29th 2017, 11:03 |
admad |
@loginews you have not set any association between UsersTable and ParamsTable, that the first prerequisite for being able to save params associated with a user. |
# |
Apr 29th 2017, 10:58 |
dereuromark |
someone could also easily implement some examples into the sandbox. |
# |
Apr 29th 2017, 10:57 |
dereuromark |
@metoyoko maybe in the bookmarker? https://github.com/FriendsOfCake/awesome-cakephp#demo |
# |
Apr 29th 2017, 10:54 |
admad |
right |
# |
Apr 29th 2017, 10:54 |
dereuromark |
ok, maybe for 4.x then |
# |
Apr 29th 2017, 10:53 |
admad |
@dereuromark i wasn't planning on removing any deprecated methods yet. Doing so would require first updating crud's SearchListener among other things. |
# |
Apr 29th 2017, 10:50 |
metoyoko |
is there any downloadable sample dealing with belongsToMany association? thanks |
# |
Apr 29th 2017, 10:46 |
metoyoko |
thanks, I found this active Cakephp community |
# |
Apr 29th 2017, 10:46 |
loginews |
@dakota would you mind looking at the gist issue ? |
# |
Apr 29th 2017, 10:44 |
dereuromark |
before releasing 3.0.1? |
# |
Apr 29th 2017, 10:44 |
dereuromark |
@admad While we are at it regarding search major: "mode (string, defaults to OR) This option is deprecated, please use fieldMode instead." Can we get rid of the old stuff that is deprecated as well? |
# |
Apr 29th 2017, 10:43 |
loginews |
ok |
# |
Apr 29th 2017, 10:43 |
dakota |
http://cakephp.loginonline.net/index.php?n=Index.ComboBoxes> <- Instead of that do: <https://book.cakephp.org/3.0/en/orm/retrieving-data-and-resultsets.html#finding-key-value-pairs |
# |
Apr 29th 2017, 10:41 |
loginews |
so are we now fighting ? :) |
# |
Apr 29th 2017, 10:40 |
dakota |
@loginews Try doing that with a VB6 app that was originally based on a COBAL app :slightly_smiling_face: |
# |
Apr 29th 2017, 10:40 |
admad |
Makes you sound like a grumpy old man who wants to stick to the old ways |
# |
Apr 29th 2017, 10:39 |
loginews |
@dakota got it. I will drop $_SERVER slowly. The apps have to stay running all the time I change the platform..! so hard. |