# |
Jan 4th 2020, 21:10 |
slackebot |
{$this->currency->system_code})"; }``` but obviously `translation` method does not exists on `PaymentType` object, i think i can achieve this by running `i18n::setLocale` to origin and then back to the, lets say, "session locale", but i feel like this is really bad approach, any ideas fellas? |
# |
Jan 4th 2020, 21:10 |
d.lisiecki93 |
gi guys, it's again me with another boring problem - i'm using i18n translations, everything works fine, but i need one non-standard thing - i would like to have virtual getter which would return mixed value of other fields BUT in my default i18n locale, so basically something like: ``` protected function _getNameWithPriceOrigin() { return "{$this->payment_type->translation('pl')->name} ({$this->amount} |
# |
Jan 4th 2020, 16:05 |
jotpe |
Hi! |
# |
Jan 4th 2020, 12:53 |
etibor |
hello mates |
# |
Jan 4th 2020, 10:33 |
ndm |
If you want to restrict access to an action/endpoint altogether, then you may want to look into the request authorization middleware. https://book.cakephp.org/authorization/2/en/request-authorization-middleware.html |
# |
Jan 4th 2020, 10:11 |
mrfeedback |
whats the best approach to use authoriazation plugin on index actions in a controller? I know that I should use the applyScope function but for me it doesn´t feel like it is the right solution therefore as I want to check if the user is allowed to access this section and not only alter the query on user level |
# |
Jan 3rd 2020, 21:50 |
ricksaccous |
yep |
# |
Jan 3rd 2020, 21:50 |
d.lisiecki93 |
again thanks mate |
# |
Jan 3rd 2020, 21:50 |
d.lisiecki93 |
yeah, i just wasted 1,5 hour of struggling with that and trying to figure out if it's my bad or plugin bug, but ye, no curse needed there |
# |
Jan 3rd 2020, 21:49 |
ricksaccous |
no need to curse lad, but no problem |
# |
Jan 3rd 2020, 21:49 |
d.lisiecki93 |
xD |
# |
Jan 3rd 2020, 21:49 |
ricksaccous |
XD |
# |
Jan 3rd 2020, 21:49 |
d.lisiecki93 |
fuck me, you're right, i'm dumb, i didn't noticed this difference at all, was focused on data types all the time, thank you so much |
# |
Jan 3rd 2020, 21:47 |
ricksaccous |
you have serialize set to be an array |
# |
Jan 3rd 2020, 21:47 |
ricksaccous |
they just set $_serialize to a string called 'data' |
# |
Jan 3rd 2020, 21:46 |
ricksaccous |
you have some differences |
# |
Jan 3rd 2020, 21:46 |
ricksaccous |
nah not really |
# |
Jan 3rd 2020, 21:46 |
d.lisiecki93 |
as on screen above, which is doc from it |
# |
Jan 3rd 2020, 21:46 |
slackebot |
<ricksaccous> |
# |
Jan 3rd 2020, 21:46 |
d.lisiecki93 |
@ricksaccous my data structure is basically the same |
# |
Jan 3rd 2020, 21:46 |
slackebot |
<d.lisiecki93> |
# |
Jan 3rd 2020, 21:46 |
ricksaccous |
also just follow the example code more closely... |
# |
Jan 3rd 2020, 21:45 |
ricksaccous |
a header is just a row |
# |
Jan 3rd 2020, 21:44 |
ricksaccous |
... |
# |
Jan 3rd 2020, 21:44 |
ricksaccous |
why would you want a multi-dimensional array header? |
# |
Jan 3rd 2020, 21:43 |
d.lisiecki93 |
also if i try to do header as multi dimensional array it does not work anymore |
# |
Jan 3rd 2020, 21:42 |
d.lisiecki93 |
header and footer are simply one dimensional array if You wonder |
# |
Jan 3rd 2020, 21:41 |
slackebot |
<d.lisiecki93> |
# |
Jan 3rd 2020, 21:41 |
d.lisiecki93 |
that's the code of method for generating CSV: |
# |
Jan 3rd 2020, 21:40 |
slackebot |
vendors to check what's going on there, and it seems like it's not handling headers / footers otherwise than, lets say, csv body data, which is meant to be multi dimensional array, for which this warning is not occuring |
# |
Jan 3rd 2020, 21:40 |
d.lisiecki93 |
i've got question about `CsvView` plugin from FriendsOfCake, not sure if there's actually bug or im doing something wrong, docs says that if i want headers and eventual footer, i should pass it as one-dimensional array, and it generally works fine, except im getting warning: ```Warning (2): fputcsv() expects parameter 2 to be array, string given [ROOT/vendor/friendsofcake/cakephp-csvview/src/View/CsvView.php, line 439]``` i did jump to |
# |
Jan 3rd 2020, 20:45 |
ricksaccous |
no problem |
# |
Jan 3rd 2020, 20:43 |
ndm |
Also https://book.cakephp.org/chronos/1/en/index.html#modifier-methods |
# |
Jan 3rd 2020, 20:38 |
d.lisiecki93 |
wow, i didn't consider it this way, my way was much worse and overcomplicated, thank you so much |
# |
Jan 3rd 2020, 20:38 |
ricksaccous |
https://book.cakephp.org/3/en/core-libraries/time.html#manipulation |
# |
Jan 3rd 2020, 20:37 |
ricksaccous |
$object->day(1); |
# |
Jan 3rd 2020, 20:36 |
d.lisiecki93 |
instance of `Cake\I18n\Time` |
# |
Jan 3rd 2020, 20:36 |
d.lisiecki93 |
hi guys, what is the fastest way to generate `Time` object with first day of current month (of current year obviously) |
# |
Jan 3rd 2020, 20:34 |
kiwi_92 |
hi |
# |
Jan 3rd 2020, 19:23 |
ricksaccous |
cake supports |
# |
Jan 3rd 2020, 19:23 |
ricksaccous |
Something like dynamo is vastly different from any other DB system |