# |
Jul 4th 2018, 08:00 |
neon1024 |
Morning all |
# |
Jul 4th 2018, 07:25 |
Boom |
#test |
# |
Jul 4th 2018, 07:24 |
Boom |
hey |
# |
Jul 4th 2018, 07:24 |
Boom |
Hello everyone |
# |
Jul 4th 2018, 07:22 |
Boom |
hi |
# |
Jul 4th 2018, 06:59 |
saeideng |
see other methods |
# |
Jul 4th 2018, 06:30 |
lubos |
How can I use MapReduce to filter data, examples I see are returning 2 or more resultSets, but I want just filter some results in same collection |
# |
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 |