# |
Jun 10th 2021, 13:51 |
philo.hamel |
https://github.com/FriendsOfCake/search/tree/master/docs#like |
# |
Jun 10th 2021, 13:49 |
philo.hamel |
```->like('myfield', [ 'field' => 'myfield', 'colType' => ['myfield' => 'string'], ])``` |
# |
Jun 10th 2021, 13:47 |
philo.hamel |
that was easier in CakePHP 2, at least that's what I'm finding while migrating our application |
# |
Jun 10th 2021, 13:46 |
kevin.pfeifer |
sometimes its not possible to just jam everything into just one search input and you have to add more inputs to allow more precise searching |
# |
Jun 10th 2021, 13:42 |
kevin.pfeifer |
well I would guess you want to do something like that, right? ```'Users.myfield LIKE' => '%test%'``` where Users.myfield is a decimal but your search input is a string |
# |
Jun 10th 2021, 13:40 |
paolo.bragagni |
PS. we are only 3 that use this slack?? :( |
# |
Jun 10th 2021, 13:39 |
paolo.bragagni |
in friendsofcake search plugin which is the best way to manage errors (I mean Cannot convert value of type `string` to a decimal) |
# |
Jun 10th 2021, 13:11 |
kevin.pfeifer |
thanks for that explanation :) |
# |
Jun 10th 2021, 13:10 |
kevin.pfeifer |
i see |
# |
Jun 10th 2021, 13:04 |
admad |
@kevin.pfeifer @thomas078 There problem isn't with env variables but with the `.env` files. Env variables as per their belong in the environment not files. The `.env` files should only be used locally to emulate env vars. In production only **actual** env vars should be used. |
# |
Jun 10th 2021, 11:30 |
slackebot |
<jpramirez> |
# |
Jun 10th 2021, 09:34 |
thomas078 |
confusing |
# |
Jun 10th 2021, 09:34 |
thomas078 |
@kevin.pfeifer how i understand is that it is atleast a performance issue. .env variables should be set to local environment, not using that file |
# |
Jun 10th 2021, 09:30 |
kevin.pfeifer |
@thomas078 I am also curious about that `.env` topic because there is no warning about that in the cakephp 4 book https://book.cakephp.org/4/en/development/configuration.html#environment-variables |
# |
Jun 10th 2021, 09:09 |
kevin.pfeifer |
or whatever webserver you are using |
# |
Jun 10th 2021, 09:08 |
kevin.pfeifer |
See https://apache.tutorials24x7.com/blog/how-to-enable-tls-1-2-and-tls-1-3-in-apache-web-server for Apache or https://www.howtoforge.com/how-to-enable-tls-13-in-nginx/ for NGINX |
# |
Jun 10th 2021, 09:07 |
kevin.pfeifer |
CakePHP doesn’t care if you call it via HTTP or HTTPS and therefore it doesn’t care if its SSL3, TLS 1.1 or TLS 1.3 The encrypted HTTP traffic is handled by your webserver |
# |
Jun 10th 2021, 09:06 |
mocelle |
Cakephp 3.9 support allready tls1.3? |
# |
Jun 10th 2021, 09:04 |
kevin.pfeifer |
@mocelle that is decided by the settings of your webserver, not cakephp |
# |
Jun 10th 2021, 08:56 |
mocelle |
How to force Client to use tls1.3? |
# |
Jun 10th 2021, 08:50 |
thomas078 |
Enabling .env on cake 3.9. Now i read documentation and is says "It is HIGHLY discouraged to use a .env file in production, due to security risks * and decreased performance on each request..." I though that .env is the way to go? |
# |
Jun 10th 2021, 08:34 |
paolo.bragagni |
in friendsofcake search plugin which is the best way to manage errors (I mean Cannot convert value of type `string` to a decimal) |
# |
Jun 10th 2021, 03:51 |
admad |
There are other webservices for the same. |
# |
Jun 10th 2021, 03:50 |
admad |
For e.g. for local/intranet use there's Mailhog |
# |
Jun 10th 2021, 03:49 |
admad |
@kevin.pfeifer a better way would be to use a different transport config based on environment/debug mode and send them all to a "mail catcher". |
# |
Jun 9th 2021, 21:26 |
kevin.pfeifer |
Is it possible to “globally overwrite” all recipients of mails sent via a Mailer? I would like to add a config for a sort of “Email debug mode” where all mails are being sent to a defined mail. Or do I have to add that logic to all my “reusable mailer functions”? |
# |
Jun 9th 2021, 13:56 |
paolo.bragagni |
found sorry |
# |
Jun 9th 2021, 13:50 |
paolo.bragagni |
I get '*Cannot convert value of type `string` to integer'* |
# |
Jun 9th 2021, 13:49 |
paolo.bragagni |
cake4/libri/?lingua_id=2 |
# |
Jun 9th 2021, 13:49 |
paolo.bragagni |
in fiendofsearch plugin I got an error searching in related |
# |
Jun 9th 2021, 11:04 |
y.teruyacookie |
Thank you very much!! I have solved this problem! |
# |
Jun 9th 2021, 10:56 |
ndm |
`['column_name' => "''"]` |
# |
Jun 9th 2021, 10:49 |
y.teruyacookie |
Thanks, but I don't get the passed code. The followings are an error log. ```Hogemodel.'' as column_name AS `Hogemodels__'' as column_name` FROM higemodels Hogemodels``` |
# |
Jun 9th 2021, 10:32 |
steinkel |
try `->select(["'' as column_name"])` |
# |
Jun 9th 2021, 10:23 |
y.teruyacookie |
Hi, I would like to ask my question. I would like to intentionally output blank columns in the CakePHP3 query builder. In the case of MySQL, you can write the following ```SELECT '' AS 'column_name' FROM hogeModel;``` It will return a column with column_name and a blank value. I would like to do the same thing with CakePHP3's query builder. If I write the following, I get a DataBase error. ```return $query |
# |
Jun 9th 2021, 10:23 |
slackebot |
->find('FinderMethod') ->select([. 'column_name' => '', ]);``` Is there any way to output a blank column? |
# |
Jun 9th 2021, 10:01 |
ndm |
https://explainextended.com/2009/09/24/adjacency-list-vs-nested-sets-postgresql/ |
# |
Jun 9th 2021, 09:57 |
eax |
Oh thanks @ndm I’ll look into that! :relaxed: |
# |
Jun 9th 2021, 09:56 |
ndm |
If you just have an adjacency list with `parent_id`, then you'd need something recursive, which could for example be achieved using common table expressions. |
# |
Jun 9th 2021, 09:50 |
eax |
@ndm: Ok, then I don’t think it’s an option here, but thanks :$ |
# |
Jun 9th 2021, 09:48 |
ndm |
Yes, that's the fields for a nested set. |
# |
Jun 9th 2021, 09:48 |
eax |
Thanks @ndm! But doesn’t that require me to have the lft and rght fields in my table? |
# |
Jun 9th 2021, 09:46 |
ndm |
@eax If you have a nested set, then you can use the `path` finder: `find('path', ['for' => $childId])` https://book.cakephp.org/3/en/orm/behaviors/tree.html |
# |
Jun 9th 2021, 09:30 |
eax |
Hey folks! Cake3 question: Is it possible to do a “reverse” threaded find? I have the “bottom” child, and would like to get the parents all the way “up” in the same Query :$ |
# |
Jun 9th 2021, 07:46 |
philo.hamel |
that's what we use to continue to use the property access |
# |
Jun 9th 2021, 07:45 |
dereuromark |
Saves also inline type annotations |
# |
Jun 9th 2021, 07:45 |
birdy247 |
So maybe we do that ->property for any code that has got defined properties |
# |
Jun 9th 2021, 07:44 |
dereuromark |
If u know the fields exist, use prop access imo. |
# |
Jun 9th 2021, 07:44 |
birdy247 |
Yes, good point |
# |
Jun 9th 2021, 07:43 |
dereuromark |
Get method is better for generic Code, like behaviors often. Phpstan likes it more then |
# |
Jun 9th 2021, 07:43 |
birdy247 |
I prefer the look of ->property in the code |
# |
Jun 9th 2021, 07:30 |
philo.hamel |
this, and I also use `$entity->property` because it's less error prone and easier with refactoring, but it's an interesting question so I'm also interested to hear from `$entity->get('property')` users |
# |
Jun 9th 2021, 07:27 |
jpramirez |
If you define the properties' types in the entity's annotations, your IDE and static analyzers will prefer `$entity->property`. |
# |
Jun 9th 2021, 07:16 |
birdy247 |
Do people recmoned direct access $entity->property or $entity->get('property') |
# |
Jun 9th 2021, 07:15 |
birdy247 |
When accessing a property in cake 3 |
# |
Jun 8th 2021, 15:08 |
neon1024 |
Ah, simple `applyOptions` |
# |
Jun 8th 2021, 15:07 |
neon1024 |
So now I wonder how to pass `beforeFind` options to contained associations |
# |
Jun 8th 2021, 15:06 |
neon1024 |
Found my issue, it was a beforeFilter in a table class that I am containing! |
# |
Jun 8th 2021, 14:36 |
neon1024 |
I loop the data, so I’ve been filthy and solved it in the php :grimacing: |
# |
Jun 8th 2021, 14:36 |
neon1024 |
Hah, fair enough |
# |
Jun 8th 2021, 14:35 |
ndm |
@neon1024 That reads as if every sentence is missing like 4 or 5 words :P But it kinda sounds like you want to use `leftJoinWith()`, as `matching()` uses an `INNER` join, so you cannot use it for optional filtering. |
# |
Jun 8th 2021, 13:39 |
paolo.bragagni |
,:) |
# |
Jun 8th 2021, 13:39 |
paolo.bragagni |
till now I port (to 4) csv :P |
# |
Jun 8th 2021, 13:38 |
paolo.bragagni |
and use tinybutstrong to build their own odt template |
# |
Jun 8th 2021, 13:37 |
paolo.bragagni |
me too. cls - xlsx - and pdf |
# |
Jun 8th 2021, 13:37 |
kevin.pfeifer |
I let users download a XLSX |
# |
Jun 8th 2021, 13:36 |
paolo.bragagni |
do you advice to use other lib ? |
# |
Jun 8th 2021, 13:36 |
paolo.bragagni |
I only need pdf library to let users download as pdf index table |
# |
Jun 8th 2021, 13:34 |
neon1024 |
I was so sure I managed it before using a combination of `matching()` and `notMatching()`, but I can’t find the post now |
# |
Jun 8th 2021, 13:34 |
kevin.pfeifer |
@neon1024 sorry, but your query filtering questions are a bit too high for me so I can’t help you ,:) |
# |
Jun 8th 2021, 13:33 |
admad |
Fair enough |
# |
Jun 8th 2021, 13:32 |
paolo.bragagni |
I had in my old temp'late and I'm desperately trying to port all 'old' work in cake4 .. |
# |
Jun 8th 2021, 13:32 |
paolo.bragagni |
thanks @admad |
# |
Jun 8th 2021, 13:30 |
erwane |
i'm using it in all my projects they need PDF ... just because i know it. I like the specific text/image positioning. Every time i want to switch, i always found "html to pdf" library type, not my needs. Maybe i need to take time to test another one. |
# |
Jun 8th 2021, 13:25 |
admad |
Never used this lib so don't know what extra features it provides over alternatives like DomPdf, mpdf. |
# |
Jun 8th 2021, 13:23 |
admad |
"CORE LIBRARY STILL REQUIRES A SIGNIFICANT AMOUNT OF WORK TO BE COMPLETED" Doesn't seem it will be ready any time soon. |
# |
Jun 8th 2021, 13:17 |
kevin.pfeifer |
well the “new” version is https://github.com/tecnickcom/tc-lib-pdf and stated `UNDER DEVELOPMENT (NOT READY)` |
# |
Jun 8th 2021, 13:17 |
admad |
Or perhaps just switch to another lib. |
# |
Jun 8th 2021, 13:16 |
admad |
Also "This version should be considered obsolete, new projects should use the new version as soon it will become stable." |
# |
Jun 8th 2021, 13:12 |
kevin.pfeifer |
If a class doesn’t specify a namespace it will live in the root namespace, therefore \ And the TCPDF Class doesn’t specify any namespace (besides the fact, that its a file with 24k lines of code :nauseated_face:) https://github.com/tecnickcom/TCPDF/blob/456b794f1fae9aee5c151a1ee515aae2aaa619a3/tcpdf.php#L137 |
# |
Jun 8th 2021, 13:10 |
paolo.bragagni |
thanks @kevin.pfeifer I missed the '\' before TCPDF |
# |
Jun 8th 2021, 13:08 |
neon1024 |
Is there any way in Cake 4's ORM to query where a parent is filtered by a association using `matching()`, but where the condition is either in the association, or there is no association? So the matching conditions would be either (A) or if the association is null. Where the foreign key is in the association, so I can’t add a where `foreign_key_id` |
# |
Jun 8th 2021, 13:02 |
kevin.pfeifer |
you don’t need to load anything manually, composer does that for you |
# |
Jun 8th 2021, 13:02 |
kevin.pfeifer |
since the TCPDF Class doesn’t live in any namespace you just need to create the object via ```$pdf = new \TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);``` |
# |
Jun 8th 2021, 12:58 |
paolo.bragagni |
hi . how to include vendor classes in my helper (Tecnickcom\tcpdf;) |
# |
Jun 7th 2021, 14:34 |
paolo.bragagni |
super . thanks |
# |
Jun 7th 2021, 14:26 |
kevin.pfeifer |
I would put it above or bellow the already present use logic |
# |
Jun 7th 2021, 14:25 |
paolo.bragagni |
when I bake it via bin/cake bake all mycontroller -t mytemplateBake |
# |
Jun 7th 2021, 14:24 |
paolo.bragagni |
I'd like to put 'use Cake\Http\Cookie\Cookie; ' at the start of my controller |
# |
Jun 7th 2021, 14:22 |
paolo.bragagni |
sorry, I explain |
# |
Jun 7th 2021, 14:20 |
paolo.bragagni |
where I have to put "use .." If I want that when i bake with my template, it compares in my controller? |
# |
Jun 7th 2021, 12:50 |
admad |
We can't add methods which work only for some cases. |
# |
Jun 7th 2021, 12:49 |
admad |
The problem with that idea is there are multiple ways to add a middleware, it could be a classname string, an object or a callable, so the remove() would only work with class name strings. |
# |
Jun 7th 2021, 12:43 |
peter.harder |
@admad thanks, will check it out! I was thinking about a “remove”-method for the middleware queue, so if I add middleware that is used by 9/10 of my controllers in Application.php, I could call `$middleware->remove('HttpsEnforceMiddleware')` for that single one. Would that be a totally crazy way of handling it? |
# |
Jun 7th 2021, 12:10 |
admad |
@peter.harder a better way will be available in 4.3 https://github.com/cakephp/cakephp/pull/15558 |
# |
Jun 7th 2021, 12:09 |
kevin.pfeifer |
you mean a SQL `WHERE field IN [1,2,3,4]` ? ```$query = $articles ->find('list') ->where(['field IN' => [1,2,3,4]);``` |
# |
Jun 7th 2021, 11:46 |
etibor |
is there an easy way to use in_array function on a find('list') ? |
# |
Jun 7th 2021, 11:26 |
etibor |
hello everyone |
# |
Jun 7th 2021, 08:29 |
kevin.pfeifer |
https://book.cakephp.org/4/en/console-commands/commands.html#calling-other-commands |
# |
Jun 7th 2021, 08:06 |
turkles |
I have a bunch of Commands I use, and I want to run a different (single) command before each one, what's the best way to do this? |