# |
May 21st 2021, 09:21 |
ndm |
@paolo.bragagni Do you plan to modify the templates? If not, then you don't need to touch them. |
# |
May 21st 2021, 08:43 |
paolo.bragagni |
and I'd like to put the policy.twig and entity_methods.twig inside a plugin |
# |
May 21st 2021, 08:43 |
paolo.bragagni |
found this https://github.com/cakephp/authorization/issues/138 but doesnt work in cakephp 4 |
# |
May 21st 2021, 07:14 |
paolo.bragagni |
Hi there is a way to bake a authorization policy taking the template from a plugin? |
# |
May 20th 2021, 23:56 |
khalil |
And I can't find one that works with 4.2 |
# |
May 20th 2021, 23:55 |
khalil |
There are a couple that work with 3.x |
# |
May 20th 2021, 23:55 |
khalil |
Guys is there any datatables plugin that works with cake 4.2 ? |
# |
May 20th 2021, 23:10 |
ndm |
no problem |
# |
May 20th 2021, 23:02 |
khalil |
Sorry for wasting your time! |
# |
May 20th 2021, 23:02 |
khalil |
Naming convention of has and belongs to many always confuses me with which should plural and which not |
# |
May 20th 2021, 23:01 |
khalil |
And I was working on the wrong file |
# |
May 20th 2021, 23:01 |
khalil |
I guess one was auto generated |
# |
May 20th 2021, 23:01 |
khalil |
for some reason, I have ProductSize and ProductsSize Entities |
# |
May 20th 2021, 23:01 |
khalil |
'_joinData' => object(App\Model\Entity\ProductsSize) |
# |
May 20th 2021, 23:00 |
khalil |
Here's what was wrong |
# |
May 20th 2021, 23:00 |
khalil |
Ok it worked now |
# |
May 20th 2021, 22:59 |
khalil |
Let me try this |
# |
May 20th 2021, 22:59 |
khalil |
One sec guys, I noticed something |
# |
May 20th 2021, 22:59 |
khalil |
No I'm saying that because `protected _virtual => [ ]` |
# |
May 20th 2021, 22:58 |
greg138 |
Because there's a *lot* of those, and not all should be empty... |
# |
May 20th 2021, 22:58 |
greg138 |
Is it really an empty array, or just saying that because it says `'[virtual]' => [ ]`? |
# |
May 20th 2021, 22:56 |
khalil |
protected _virtual is an empty array |
# |
May 20th 2021, 22:55 |
slackebot |
]` `protected _registryAlias => 'ProductsSizes'` `}` |
# |
May 20th 2021, 22:55 |
slackebot |
=> [ ]` `'[hasErrors]' => *false*` `'[errors]' => [ ]` `'[invalid]' => [ ]` `'[repository]' => 'ProductsSizes'` `protected _accessible => [ ]` `protected _fields => [ ]` `protected _original => [ ]` `protected _hidden => [ ]` `protected _virtual => [ ]` `protected _dirty => [ ]` `protected _accessors => [ ]` `protected _new => *false*` `protected _errors => [ ]` `protected _invalid => [ |
# |
May 20th 2021, 22:55 |
khalil |
`'_joinData' => object(App\Model\Entity\ProductsSize) id:*1* {'id' => (int) *23*` `'size_id' => '10'` `'product_id' => (int) *53*` `'width' => '10.000'` `'height' => '20.000'` `'length' => '30.000'` `'weight' => '40.000'` `'price' => '50.00'` `'stock' => (int) *12*` `'is_default' => *false*` `'[new]' => *false*` `'[accessible]' => [ ]` `'[dirty]' => [ ]` `'[original]' => [ ]` `'[virtual]' |
# |
May 20th 2021, 22:53 |
khalil |
Wait i'll show you the results of that |
# |
May 20th 2021, 22:53 |
ndm |
I mean inside of the `_getLocalPrice` method |
# |
May 20th 2021, 22:52 |
khalil |
The price in the db does contain the value, and I can access it in the template |
# |
May 20th 2021, 22:51 |
ndm |
Have you debugged it? Like, whether the method is being invoked, and whether the price contains the correct value? |
# |
May 20th 2021, 22:50 |
khalil |
I have no idea, It returns null |
# |
May 20th 2021, 22:50 |
ndm |
And how did that fail? |
# |
May 20th 2021, 22:48 |
khalil |
```protected $_virtual = ['local_price']; protected function _getLocalPrice() { return $this->_util->convertFromUSD($this->price); }``` |
# |
May 20th 2021, 22:47 |
ndm |
How exactly did you try to add the field to your join table entity results? |
# |
May 20th 2021, 22:36 |
slackebot |
the virtual field on ProductSizes and it also didn't work. Any idea how to achieve this in a HABTMT relation? |
# |
May 20th 2021, 22:36 |
khalil |
Hello guys! A question that I can't seem to find answer for in the documentation I have a Products model that's linked to Sizes through ProductSizes, ProductSizes contains an additional field which is "price" I'm doing conversion on this price, so I'm creating a virtual field in the Product entity which is "local_price", but this needs to be accessed from ProductSizes, and it's not working no matter what I try, I tried to add |
# |
May 20th 2021, 14:38 |
kushan |
Thanks @ndm |
# |
May 20th 2021, 14:35 |
ndm |
yes |
# |
May 20th 2021, 14:34 |
kushan |
I'm using CakePHP v4.x and Authentication 2.x plugin |
# |
May 20th 2021, 14:33 |
kushan |
Hi, may I know to use JWT authenticator in my app, do I need to add firebase/php-jwt into my composer.json? |
# |
May 20th 2021, 14:28 |
eax |
Excellent, thanks so much @ndm :$ |
# |
May 20th 2021, 14:28 |
ndm |
Yes, you can use the `skipLog` option in the `Error` config to define a list of exceptions that should not be logged. https://github.com/cakephp/app/blob/3.9.1/config/app.php#L174 |