# |
Dec 27th 2019, 13:28 |
gianmarxgagliardi |
when i add (in matches controller) it gives me this error: `ExistsIn rule for 'club_home_id' is invalid. 'Clubs' is not associated with 'App\Model\Table\MatchesTable'.` |
# |
Dec 27th 2019, 13:14 |
slackebot |
<ashesh.social> |
# |
Dec 27th 2019, 13:13 |
ashesh.social |
Tried adding mailgun to my project and started following the steps where @challgren posted. Finding a issue while composer require |
# |
Dec 27th 2019, 13:10 |
peppejaripappalardo |
i doing it |
# |
Dec 27th 2019, 12:25 |
dereuromark |
I still didnt publish my 1year old heroku blog post, time to do that now on xmas holidays: https://www.dereuromark.de/2019/12/27/cakephp-and-heroku/ |
# |
Dec 27th 2019, 12:23 |
dereuromark |
or you have a more complex app? |
# |
Dec 27th 2019, 12:05 |
dereuromark |
works fine. |
# |
Dec 27th 2019, 12:05 |
dereuromark |
do you need docker for this? I just deployed a normal app using basic composer commands. |
# |
Dec 27th 2019, 12:02 |
wizardfix |
Using Docker, I mean. :) |
# |
Dec 27th 2019, 11:55 |
wizardfix |
Hi. :) I want to containerise a CakePHP 3.8 application for deployment to Heroku. Can anyone please recommend a good guide / things to look out for? :thinking_face: |
# |
Dec 27th 2019, 11:40 |
gianmarxgagliardi |
thanks it's work |
# |
Dec 27th 2019, 11:38 |
ndm |
not sure if I got the names right, but that's generally how you'd do it |
# |
Dec 27th 2019, 11:38 |
ndm |
You need to contain that association then, and use a dot notated path to access the property, like: ```$this->Matches->SeasonReferees ->find('list', ['keyField' => 'id', 'valueField' => 'referee.full_name']) ->contain('Referees');``` |
# |
Dec 27th 2019, 11:36 |
ndm |
no problem |
# |
Dec 27th 2019, 11:36 |
gianmarxgagliardi |
I'm sorry if I explained myself wrong |
# |
Dec 27th 2019, 11:35 |
gianmarxgagliardi |
exactly |
# |
Dec 27th 2019, 11:35 |
ndm |
So your value fields refer to fields that belong to the entity of an association? |
# |
Dec 27th 2019, 11:34 |
ndm |
I have hard time following your explanations, sorry. It might be easier to show what results you get and what you need (code wise). |
# |
Dec 27th 2019, 11:34 |
gianmarxgagliardi |
'keyField' must have season_referees ID value and valueField name and surname taken from referees |
# |
Dec 27th 2019, 11:32 |
gianmarxgagliardi |
in the sense I could go down to the level of referees getting senzxa problems name and surname but I would not have the correct ID or that of season_referees |
# |
Dec 27th 2019, 11:31 |
ndm |
Your list finder snippet should work fine (no nested array required though), maybe explain what exactly is happening, ie what do the results look like? |
# |
Dec 27th 2019, 11:30 |
gianmarxgagliardi |
sorry I did not understand |
# |
Dec 27th 2019, 11:28 |
gianmarxgagliardi |
i'm using cake 3.8 |
# |
Dec 27th 2019, 11:26 |
steinkel |
https://github.com/cakephp/cakephp/blob/master/src/ORM/Table.php#L1309 this is how find list does it |
# |
Dec 27th 2019, 11:26 |
ndm |
Ackchyually... the list finder already uses a result formatter that combines the fields ;) |
# |
Dec 27th 2019, 11:26 |
steinkel |
try find/formatResults/combine |
# |
Dec 27th 2019, 11:25 |
gianmarxgagliardi |
Undefined property `cognome`. You have not defined the `cognome` association on `App\Model\Table\RefereesTable`. |
# |
Dec 27th 2019, 11:24 |
gianmarxgagliardi |
```$seasonReferees = $this->Matches->SeasonReferees->find('list', ['keyField' => 'id', 'valueField' =>function($fullName){ $fullName=$this->Matches->SeasonReferees->Referees; return $fullName->cognome .' '. $fullName->nome; }]);``` |
# |
Dec 27th 2019, 11:24 |
gianmarxgagliardi |
I would have tried something like that but it doesn't work |
# |
Dec 27th 2019, 11:18 |
steinkel |
I'd say, instead of using find('list'), use find to get all the required columns, then `combine` or formatResults |
# |
Dec 27th 2019, 11:16 |
steinkel |
`full_name` is not available in the context of a find |
# |
Dec 27th 2019, 11:16 |
steinkel |
@gianmarxgagliardi you're trying to use an Entity accessor as part of a query, see https://book.cakephp.org/3/en/orm/entities.html#creating-virtual-fields |
# |
Dec 27th 2019, 11:03 |
gianmarxgagliardi |
```$seasonReferees = $this->Matches->SeasonReferees->find('list', ['keyField' => 'id', 'valueField' =>['full_name']]);``` |
# |
Dec 27th 2019, 11:02 |
gianmarxgagliardi |
I should print in the form the name and surname of the referee only that I don't know how to take them |
# |
Dec 27th 2019, 11:02 |
gianmarxgagliardi |
this is the piece of code that gives me problems in the Matches add |
# |
Dec 27th 2019, 11:01 |
gianmarxgagliardi |
only when I have problems accessing the referees first and last name field |
# |
Dec 27th 2019, 11:01 |
gianmarxgagliardi |
now I should put everything in the field of a form |
# |
Dec 27th 2019, 11:01 |
gianmarxgagliardi |
```protected function _getFullName() { return $this->cognome . ' ' . $this->nome; }``` |
# |
Dec 27th 2019, 11:00 |
gianmarxgagliardi |
in referees I made method in the entity |
# |
Dec 27th 2019, 10:58 |
gianmarxgagliardi |
I would have these relationships I should print as season_referees id and id referees first and last name |
# |
Dec 27th 2019, 10:40 |
challgren |
To follow conventions? |