# |
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? |
# |
Dec 27th 2019, 10:40 |
challgren |
And do you think deliverBy should maybe be changed to set/get? |
# |
Dec 27th 2019, 10:28 |
challgren |
Is all 3 maybe Overkill? |
# |
Dec 27th 2019, 10:28 |
challgren |
Yeah the docs need to be redone now that there's an email, mailer and trait |
# |
Dec 27th 2019, 10:24 |
dereuromark |
keep things agnostic here, instead add a good table e.g. linked from the readme, in my case I do that in the wiki home |
# |
Dec 27th 2019, 10:24 |
dereuromark |
yeah adding the concrete versions in readme title and composer description is usually an anti pattenr. it always gets outdated and lying. |
# |
Dec 27th 2019, 10:21 |
challgren |
Can anyone familiar with cake 4 do a code review real quick and see if I'm doing anything stupid https://github.com/narendravaghela/cakephp-mailgun |
# |
Dec 27th 2019, 09:19 |
alexdd55976 |
@admad how can i get rid of all those node modules... do not need that any more |
# |
Dec 27th 2019, 09:04 |
alexdd55976 |
does not sound right to me tho |
# |
Dec 27th 2019, 09:03 |
alexdd55976 |
that means i have to put that in the UIView directly, which would be directly in the repo |