# |
Jul 30th 2021, 14:46 |
upgrad3d57 |
I just want to delete multiple records based off of a non-primary-key field. |
# |
Jul 30th 2021, 14:45 |
upgrad3d57 |
Anyone give support on why when I use $this->Model->deleteAll(['non_public_key' => $someId); it tells me that it's looking for the Model.id and can't find the field? (There is no ID field on that table) |
# |
Jul 28th 2021, 10:25 |
dereuromark |
@brandon if you want to avoid inline annotation use the props :) Thats why they are typed in annotations, and kept up to date using IdeHelper |
# |
Jul 28th 2021, 10:15 |
paolo.bragagni |
boolan filed is not marked as 'required' |
# |
Jul 28th 2021, 09:47 |
paolo.bragagni |
how to fire a provider rule only when create |
# |
Jul 28th 2021, 07:07 |
paolo.bragagni |
found thanks |
# |
Jul 28th 2021, 07:01 |
paolo.bragagni |
``` $validator->add('title', 'custom', [ 'rule' => 'nosame', 'provider'=>'custom', 'message'=>'custom message' ]); ``` |
# |
Jul 28th 2021, 07:00 |
paolo.bragagni |
how to pass $model? |
# |
Jul 28th 2021, 07:00 |
paolo.bragagni |
for example I'd like to not permit inserting same value so I have to access to model and make a query for $check in $model |
# |
Jul 28th 2021, 06:59 |
paolo.bragagni |
public function nosame($check,$model) : bool |
# |
Jul 28th 2021, 06:58 |
paolo.bragagni |
but How can I pass to it other variables? |
# |
Jul 28th 2021, 06:58 |
paolo.bragagni |
built a Provider and strange but true it works |
# |
Jul 28th 2021, 06:03 |
slackebot2 |
```Access to an undefined property Cake\Datasource\EntityInterface::$type.``` But if I add the following above the code, the error goes away ```/** @var \Inventory\Model\Entity\Attribute $attribute */``` What is the best practice here? Am I missing something? |
# |
Jul 28th 2021, 06:03 |
brandon |
I'm working on cleaning up my code with phpstan. One of the things it complains about a lot of `Access to an undefined property object::$var` for things like `Model->get()` where it can return the Model or an EntityInterface. Am I supposed to use the `@var` doc each time? Here is an example: ```$attribute = $this->AttributeValues->Attributes->get($attribute_id); $datetime = $attribute->type == 'datetime';``` phpstan complains: |
# |
Jul 28th 2021, 04:58 |
brandon |
Where do you put this config? Also, level 6!? Oof. |
# |
Jul 28th 2021, 03:56 |
rohit.onus |
Hi, Anyone using Mpdf library in cakephp 2 ? I'm getting error in load Mpdf library *Class 'Mpdf\Mpdf' not found.* |
# |
Jul 27th 2021, 22:39 |
cnizzardini |
Either hardcode on server or if you're using k8s in configmap or Swarm via env in docker compose. Depends on your infrastructure |
# |
Jul 27th 2021, 22:38 |
cnizzardini |
Yep that would cause it. Don't sent envars via nginx |
# |
Jul 27th 2021, 19:22 |
kevin.pfeifer |
or copy/write the string in a text file and view that file with a hexeditor to see what it actually is |
# |
Jul 27th 2021, 19:10 |
mrgrimpy |
I think I just found the problem. It's when I run bin/cake bake model from CLI (no environment variables). What would be the easiest workaround? |
# |
Jul 27th 2021, 19:01 |
mrgrimpy |
It's in the environment. What's even stranger is when I go in the env() function and I add `if ($val == 'DATABASE_FOO_URL') {` `dd($val):` `}` I get the DSN string. I'm very confused. |
# |
Jul 27th 2021, 18:58 |
kevin.pfeifer |
but yes, the whole encoding bullshit is such a mess |
# |
Jul 27th 2021, 18:58 |
kevin.pfeifer |
you could try https://github.com/neitanod/forceutf8 and see if that helps |
# |
Jul 27th 2021, 18:57 |
kevin.pfeifer |
well as the doc says for mb_detect_encoding() ```Detects the most likely character encoding for string string from an ordered list of candidates.``` |
# |
Jul 27th 2021, 18:54 |
greg138 |
So, this is weird. `mb_check_encoding($filename, 'UTF-8')` returns false. `mb_detect_encoding($filename)` returns "UTF-8"... |
# |
Jul 27th 2021, 18:46 |
paolo.bragagni |
I Need or now only dire One tabke and there are not one line logic. The problem Is that i am not able to write a provider... |
# |
Jul 27th 2021, 18:46 |
greg138 |
Is that actually in your environment, or using a `.env` file and importing that? |
# |
Jul 27th 2021, 18:40 |
slackebot2 |
_Mysql_::class,` `],` |
# |
Jul 27th 2021, 18:40 |
mrgrimpy |
Hi, I'm encountering a weird problem today concerning my database configuration. I set an environment variable via fastcgi_param (DATABASE_FOO_URL) in my Nginx configuration containing a DSN string. Here is my entry in Datasources (app.php): `'foo' => [` `'url' => env('DATABASE_FOO_URL'),` `'className' => _Connection_::class,` `'driver' => |
# |
Jul 27th 2021, 18:25 |
vinicius.big |
I'll check this, it seems the way to go! thanks! |
# |
Jul 27th 2021, 18:24 |
vinicius.big |
nice to meet you, Skie! LOL! |
# |
Jul 27th 2021, 18:23 |
skie956 |
You can use cakephp-fixture-factories from the seeds. It uses faker in background, and the nice thing that it can be configured to generate dependent data, with the root level entity. |
# |
Jul 27th 2021, 18:23 |
skie956 |
I am skie ;) |
# |
Jul 27th 2021, 18:22 |
vinicius.big |
Yeah,,, I'm already using Faker. Its a good approach... But I'm lookign for a easy way to create related data. And thats the goal of skie/cakephp-factory-muffin. Here a example of using it. |
# |
Jul 27th 2021, 18:21 |
cnizzardini |
Too bad the cakephp adpater is for 2.x |
# |
Jul 27th 2021, 18:19 |
cnizzardini |
I've heard of it, but never personally used it. |
# |
Jul 27th 2021, 18:18 |
cnizzardini |
@vinicius.big you can try something like this: https://github.com/fzaninotto/Faker |