Log message #4155567

# At Username Text
# Jul 4th 2018, 05:33 slackebot4 'Offers', 'foreignKey' => 'offer_id', 'targetForeignKey' => 'related_id', 'joinTable' => 'offers_related', 'conditions' => [ 'OffersRelated.type' => 'upsell', ] ]); ``` I am using `offers_related` table as joinTable and type condition just because I am same joinTable for multiple associations. In your case related / suppressed will be affilated
# Jul 4th 2018, 05:33 lubos @pmoraes Here is my example in `OffersTable.php` ``` $this->belongsToMany('Suppressed', [ 'className' => 'Offers', 'foreignKey' => 'offer_id', 'targetForeignKey' => 'related_id', 'joinTable' => 'offers_related', 'conditions' => [ 'OffersRelated.type' => 'suppressed', ] ]); $this->belongsToMany('Upsell', [ 'className' =>
# Jul 4th 2018, 05:29 lubos I think your className and the name of association should be different
# Jul 4th 2018, 05:19 liaogz82 can a custom field be created out from the entity?
# Jul 4th 2018, 04:55 liaogz82 say I want a custom field `date` from `created_at` datetime field. Just the date will do
# Jul 4th 2018, 04:54 liaogz82 guys how do I make custom fields in cakephp?
# Jul 4th 2018, 02:54 pmoraes ``` $this->belongsToMany('AffiliatedCompanies', [ 'className' => 'Companies', 'foreignKey' => 'company_id', 'targetForeignKey' => 'affiliated_company_id', 'joinTable' => 'affiliated_companies' ]);````
# Jul 4th 2018, 02:53 pmoraes Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'company_id' in 'where clause'
# Jul 4th 2018, 02:53 pmoraes let me check
# Jul 4th 2018, 02:53 pmoraes hmm
# Jul 4th 2018, 02:53 hmic only the association name
# Jul 4th 2018, 02:52 hmic no, classname does not change there
# Jul 4th 2018, 02:52 pmoraes this its not saving anything
# Jul 4th 2018, 02:52 pmoraes ```$this->belongsToMany('AffiliatedCompanies', [ 'className' => 'AffiliatedCompanies', 'foreignKey' => 'company_id', 'targetForeignKey' => 'affiliated_company_id', 'joinTable' => 'affiliated_companies' ]);```
# Jul 4th 2018, 02:50 pmoraes I already did that many times
# Jul 4th 2018, 02:50 hmic pmoraes: it would rather need to read ...belongsToMany('AffiliatedCompanies', [ ...
# Jul 4th 2018, 02:49 pmoraes anyone has some idea about what is happening?
# Jul 4th 2018, 02:49 pmoraes $this->Form->control('companies._ids'
# Jul 4th 2018, 02:49 pmoraes in my form I have
# Jul 4th 2018, 02:48 pmoraes File uploaded https://cakesf.slack.com/files/U6X99ATG8/FBKMD6VV5/captura_de_tela_2018-07-03_a__s_23.48.10.png / https://slack-files.com/T053DPNCM-FBKMD6VV5-8264b4b991
# Jul 4th 2018, 02:48 pmoraes its saving so
# Jul 4th 2018, 02:48 pmoraes if I invert the foreignKey and targetForeignKey
# Jul 4th 2018, 02:48 pmoraes File uploaded https://cakesf.slack.com/files/U6X99ATG8/FBJ3FDR97/captura_de_tela_2018-07-03_a__s_23.47.28.png / https://slack-files.com/T053DPNCM-FBJ3FDR97-166d34e044
# Jul 4th 2018, 02:47 pmoraes in this case it saving the affiliated_company_id in company_in and in affiliated_company_id its saving 0
# Jul 4th 2018, 02:46 pmoraes company_id and affiliated_company_id
# Jul 4th 2018, 02:46 pmoraes in my affiliated_companies I have
# Jul 4th 2018, 02:45 pmoraes `$this->belongsToMany('Companies', [ 'className' => 'Companies', 'foreignKey' => 'company_id', 'targetForeignKey' => 'affiliated_company_id', 'joinTable' => 'affiliated_companies' ]);`
# Jul 4th 2018, 02:45 pmoraes I'm doing this
# Jul 4th 2018, 02:44 pmoraes I will have affiliated companies
# Jul 4th 2018, 02:44 pmoraes or better
# Jul 4th 2018, 02:44 pmoraes like Companies belongsToMany Companies
# Jul 4th 2018, 02:44 pmoraes I need to make a relation between the same table
# Jul 4th 2018, 02:44 pmoraes I'm having a doubt about the HABTM
# Jul 4th 2018, 02:44 pmoraes Hey guys
# Jul 3rd 2018, 16:32 dakota You would get the response body using the response object like `(string)$this->_response->getBody()`
# Jul 3rd 2018, 16:32 dakota https://book.cakephp.org/3.0/en/development/testing.html#testing-a-json-responding-controller
# Jul 3rd 2018, 16:32 dakota Only saw this now. You don’t check the result of `get` (Since it doesn’t actually return anything)
# Jul 3rd 2018, 16:12 admad Might also have to update validOptions in view class
# Jul 3rd 2018, 16:11 admad I believe there's viewbuilder::set options()
# Jul 3rd 2018, 15:50 zmurphy What's the preferred method of passing something to the AppView class, but not necessarily the view file? I need to pass the current user's id to a helper loaded in AppView's initialize.
# Jul 3rd 2018, 14:33 neon1024 Or use @dereuromark upgrade shell