# |
Sep 5th 2019, 21:21 |
challgren |
5.4>= |
# |
Sep 5th 2019, 21:21 |
challgren |
Hmm weird |
# |
Sep 5th 2019, 21:20 |
dereuromark |
'null', 'string', 'array' should be 'string', 'array', 'null' but it also switches the non-mapped ones. |
# |
Sep 5th 2019, 21:20 |
dereuromark |
Not sure how this can easily be solved. |
# |
Sep 5th 2019, 21:19 |
dereuromark |
No, in PHP7 the order is switched, and that kills the whole thing :( |
# |
Sep 5th 2019, 21:19 |
challgren |
Ohh well my guess is cause you were using short arrays |
# |
Sep 5th 2019, 21:17 |
dereuromark |
@challgren I wanted to keep the [string, array] here. |
# |
Sep 5th 2019, 21:17 |
ricksaccous |
@maymeow what does your entity look like after patch? |
# |
Sep 5th 2019, 21:15 |
maymeow |
address php ``` protected $_accessible = [ 'user_id' => true, 'name' => true, 'street' => true, 'postcode' => true, 'user' => true, 'phone' => true, 'town' => true, 'authorized_persons' => true, 'posts' => true ]; ``` profile.php ``` protected $_accessible = [ 'user_id' => true, 'name' => true, 'user' => true ]; ``` |
# |
Sep 5th 2019, 21:15 |
challgren |
@dereuromark https://3v4l.org/CtY7X |
# |
Sep 5th 2019, 21:14 |
maymeow |
but when i add `echo $this->Form->control('profile.name', ['label' => __('name')]);` it returns error about missing user_id in profile |
# |
Sep 5th 2019, 21:13 |
slackebot |
has many addresses and i saving it with `$this->User->save(...)` nothing special |
# |
Sep 5th 2019, 21:13 |
slackebot |
__('ZIP')]); echo $this->Form->control('addresses.0.town', ['label' => __('Town'), 'value' => '']); echo $this->Form->control('addresses.0.phone', ['label' => __('Phone number')]); echo $this->Form->control('addresses.0.authorized_persons', ['label' => __('Authorized persons for posts take')]); ?> </div> </div> ``` user |
# |
Sep 5th 2019, 21:13 |
slackebot |
<div class="card-header"><?= __('Address information') ?></div> <div class="card-body"> <?php echo $this->Form->control('addresses.0.name', ['label' => __('Name and surname')]); echo $this->Form->control('addresses.0.street', ['label' => __('Street and house number')]); echo $this->Form->control('addresses.0.postcode', ['label' => |
# |
Sep 5th 2019, 21:13 |
maymeow |
@ricksaccous ``` </div> <div class="card-footer"> <?= $this->Form->button(__('Save'), ['class' => 'btn btn-success']) ?> <?= $this->Html->link(__('Cancel'), ['action' => 'index'], ['class' => 'btn btn-danger']) ?> </div> </div> </div> <div class="col-md-6"> <div class="card"> |
# |
Sep 5th 2019, 21:12 |
dereuromark |
Does anyone have an idea how I can fix a usort() callback that it works also in php7, not just in php5? https://3v4l.org/1k098 |
# |
Sep 5th 2019, 21:11 |
ricksaccous |
https://book.cakephp.org/3.0/en/orm/saving-data.html#saving-hasone-associations |
# |
Sep 5th 2019, 21:10 |
maymeow |
for belongs to it was ` <?= $this->form->create('profile.user_name`)?>` but for hasone it return eror about `user_id has not default value` any ideas? |
# |
Sep 5th 2019, 21:09 |
maymeow |
how to create form for has one association?? |
# |
Sep 5th 2019, 20:00 |
challgren |
You could write a script to check the tunnel if the port is open and if not restart the tunnel |
# |
Sep 5th 2019, 20:00 |
ricksaccous |
cool, thanks for the ideas guys |
# |
Sep 5th 2019, 20:00 |
challgren |
Thats what I would do |
# |
Sep 5th 2019, 20:00 |
ricksaccous |
in case you have to restart the server |
# |
Sep 5th 2019, 20:00 |
ricksaccous |
interesting, so maybe at most you'd have a server start up script to create the tunnel |
# |
Sep 5th 2019, 19:59 |
admad |
i wouldn't put anything related to ssh tunneling in php :slightly_smiling_face: |
# |
Sep 5th 2019, 19:58 |
ricksaccous |
lol okay, but if you were faced with that issue, what would you do? |
# |
Sep 5th 2019, 19:58 |
admad |
you can do whatever you want in your custom connection class :slightly_smiling_face: |
# |
Sep 5th 2019, 19:54 |
ricksaccous |
or whatever class ultimately makes the connection |
# |
Sep 5th 2019, 19:53 |
ricksaccous |
when you connect |
# |
Sep 5th 2019, 19:53 |
ricksaccous |
but it might be nice to check if tunnel was there, and if not create it |
# |
Sep 5th 2019, 19:53 |
ricksaccous |
that's what i've done before |
# |
Sep 5th 2019, 19:52 |
admad |
why would there be? create the tunnel and specify port in cake db config |
# |
Sep 5th 2019, 19:52 |
challgren |
You’d probably have to create the tunnel first |
# |
Sep 5th 2019, 19:49 |
ricksaccous |
is there a built in cake way to tunnel via ssh to access mysql |
# |
Sep 5th 2019, 18:56 |
slackebot |
to retrieve associated data twice removed with a single query. |
# |
Sep 5th 2019, 18:56 |
ckjksl |
yes, sorry, that was a typo on my part typing it into the chat. I couldn't edit it after I submitted the next comment. But the error i get remains the same: unable to find column 'Projects.projectCodes.title'. I've cheated for now by including it in the contain array: `->contain(['Projects'=>[...],'templateitems','Projects.ProjectCodes']` and stealing it from that the longer, roundabout way. It would still be useful to know if it's possible |
# |
Sep 5th 2019, 18:51 |
rochasmarcelo |
@ckjksl double 's' at ``` 'Projectss' => [```, should not be ```'Projects' =>[``` |
# |
Sep 5th 2019, 17:41 |
ckjksl |
Phew. Okay, so this query looks and works fine. The problem now is that I want the column of an associated data from Projects. I need: `Projects.projectCode.title`. |
# |
Sep 5th 2019, 17:35 |
ckjksl |
I'm currently doing a query and it looks like this: ` $otheritems = $this->projectitems->find()->where(['projectitem_id'=>$thisprojectitem_id]) ->contain([ 'projects' => [ 'fields' => [ // Aliased fields in contain() must include // the model prefix to be mapped correctly. 'projectname' => |
# |
Sep 5th 2019, 17:35 |
slackebot |
'Projects.name' ] ], 'projectitems' ])->sortBy('projectitems.created');` |
# |
Sep 5th 2019, 15:56 |
slackebot |
{"0":"public.people.landing","action":"display","controller":"Pages","plugin":null} | | members:display | /people/* | {"action":"display","controller":"Members","plugin":null} |``` |