# |
Apr 18th 2017, 20:19 |
philipgrey |
I want to filter it by the company_id |
# |
Apr 18th 2017, 20:19 |
philipgrey |
Right now, both rels are going to return all data from Table2 |
# |
Apr 18th 2017, 20:18 |
philipgrey |
```$this->belongsToMany('Company1Table2',[ 'className' => 'Table2', 'foreignKey' => 'table_1_id', 'targetForeignKey'=>'table_2_id', ]); $this->belongsToMany('Company2Table2',[ 'className' => 'Company1Table2', 'foreignKey' => 'table_1_id', 'targetForeignKey'=>'table_2_id' ]);``` |
# |
Apr 18th 2017, 20:18 |
philipgrey |
sup guys, hope all is well. so let’s say i have table 1 that has a belongsToMany with table 2. table 2 has a field called company_id. i want to make a rel on table 1 to get a set of records associated with company_id 1 and company_id 2, so i’m defining multiple rels like so… |
# |
Apr 18th 2017, 20:13 |
sjundee |
I have granted all privileges to db user to see if that was the problem, which it wasnt |
# |
Apr 18th 2017, 20:11 |
sjundee |
I had a similar problem on the virtual box before I added `$this->Auth->allow([*])` in AppController. |
# |
Apr 18th 2017, 20:10 |
sjundee |
Now when I'm deploying my app, most things seems to run fine, but when trying to edit/update rows, some strange things happens: 1. flash for if($saved) does not appear and I don't get redirected. 2. flash for if(!$saved) does not appear |
# |
Apr 18th 2017, 19:57 |
kailas |
@sjundee ah, it was actually correct as written. the issue was that the validation was for creation of associated records and i wasn’t handling the validation failure correctly |
# |
Apr 18th 2017, 19:36 |
kailas |
k, will try |
# |
Apr 18th 2017, 19:29 |
sjundee |
Try to `debug($context)` |
# |
Apr 18th 2017, 19:29 |
sjundee |
@kailas I think it should be only `$context['order_qty']` |
# |
Apr 18th 2017, 19:23 |
kailas |
@sjundee yeah. https://book.cakephp.org/3.0/en/core-libraries/validation.html#custom-validation-rules suggested that the data was passed through $context, but i’m honestly not exactly sure what that means. |
# |
Apr 18th 2017, 19:18 |
sjundee |
@theaxiom Thanks for your help! Now I have at least managed to make a subdomain with DocumentRoot: `~/my_app_name/webroot/`. Composer works, so things looks good :slightly_smiling_face: Thanks alot for taking your time. |
# |
Apr 18th 2017, 19:09 |
sjundee |
@kailas You are comparing `$value` to `$context['data']['order_qty']` ? |
# |
Apr 18th 2017, 19:05 |
kailas |
I’m trying to create a validation rule for one field (invoice_qty) that’s based on another field (order_qty). https://gist.github.com/kailasnarendran/e4dfc479757d693844c0d35aa8838175 is that correct? if so, doesn’t seem to work, so i must be missing something :slightly_smiling_face: |
# |
Apr 18th 2017, 18:58 |
sjundee |
Is it only files and folder inside apache DocumentRoot that is public? |
# |
Apr 18th 2017, 18:56 |
sjundee |
Now composer works. Had too disable `suhosin` in php.ini |
# |
Apr 18th 2017, 18:52 |
sjundee |
When running composer-commands, I don't get `command not found`. So it should be there, right? |
# |
Apr 18th 2017, 18:47 |
sjundee |
Yes, but I can locate `/etc/profile.d/cpanel-php-composer.sh`. So don't know what's broke. |
# |
Apr 18th 2017, 18:43 |
theaxiom |
you can download composer.phar and run it directly @sjundee |
# |
Apr 18th 2017, 18:13 |
sjundee |
Sent a ticket an hours ago as well. Composer is broken :( |
# |
Apr 18th 2017, 18:12 |
sjundee |
Yup. I'll send a support ticket right away :slightly_smiling_face: That will (hopefully) make it easy to use `~/myapp/webroot/` as a working document root. |
# |
Apr 18th 2017, 18:09 |
theaxiom |
they should have no problem giving you write access |
# |
Apr 18th 2017, 18:08 |
theaxiom |
maybe submit a support ticket to your provider |
# |
Apr 18th 2017, 18:08 |
theaxiom |
that sucks |
# |
Apr 18th 2017, 18:08 |
sjundee |
Thanks for the tips @theaxiom . I see I only have reading permission to domain.com (the file located in `var/cpanel/userdata/USERNAME/`. |
# |
Apr 18th 2017, 17:55 |
theaxiom |
@sjundee https://www.servint.net/university/article/the-tech-bench-changing-a-document-root-in-cpanel/ |
# |
Apr 18th 2017, 17:04 |
sjundee |
Have fun ;) Thanks |
# |
Apr 18th 2017, 17:04 |
theaxiom |
I have to run to the pet store |
# |
Apr 18th 2017, 17:04 |
theaxiom |
take care |
# |
Apr 18th 2017, 17:04 |
theaxiom |
:slightly_smiling_face: |
# |
Apr 18th 2017, 17:04 |
hmic |
clone to an empty dir of your choice, set webroot in cpanel to the apps webroot - done. |
# |
Apr 18th 2017, 17:03 |
sjundee |
Ill check that out :slightly_smiling_face: |
# |
Apr 18th 2017, 17:03 |
hmic |
so there you go! |
# |
Apr 18th 2017, 17:03 |
theaxiom |
Then you don't even need a symlink |
# |
Apr 18th 2017, 17:03 |
sjundee |
cpanel |
# |
Apr 18th 2017, 17:03 |
theaxiom |
Which hosting control panel are you using? |
# |
Apr 18th 2017, 17:03 |
theaxiom |
if you are using cPanel you can change the default public_html directory directly to your webroot |
# |
Apr 18th 2017, 17:03 |
sjundee |
Earlier I have cloned all files into `~/` but ´webroot´ that has been cloned to `~/public_html/`. That worked fine. But I realize I probably should mess up with server files and my app files in `~/`. |
# |
Apr 18th 2017, 17:01 |
theaxiom |
that is by far the easiest method |
# |
Apr 18th 2017, 17:01 |
theaxiom |
hmic said to clone your code to a folder beside public_html then symlink webroot to public_html |