# |
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 |
# |
Jul 27th 2021, 18:10 |
vinicius.big |
yeah... I mean loading testing data, seeding the database. |
# |
Jul 27th 2021, 18:07 |
kevin.pfeifer |
I guess Vinicius Arantes means loading (test-)data into the “live” database. The fixture factories are only usable inside the tests as far as I know |
# |
Jul 27th 2021, 17:56 |
skie956 |
You can take a look into https://github.com/vierge-noire/cakephp-fixture-factories |
# |
Jul 27th 2021, 17:56 |
skie956 |
Wow, I even dont remember i did it. |
# |
Jul 27th 2021, 17:48 |
greg138 |
It came from the database, which is UTF-8, but I'll check this. |
# |
Jul 27th 2021, 17:47 |
kevin.pfeifer |
could be that the è is encoded in something other then UTF-8 |
# |
Jul 27th 2021, 17:46 |
kevin.pfeifer |
have you tried checking the string if its actually a valid UTF-8 string? ```mb_check_encoding($string, 'UTF-8');``` |
# |
Jul 27th 2021, 17:43 |
vinicius.big |
hey folks. There is any plugin/solution to create generate dummy data for my entities? For Cake4. The Real World Example App uses skie/cakephp-factory-muffin but its using Cake 3.8 Other examples on Cake awesome List are still using cake3 also. |
# |
Jul 27th 2021, 16:58 |
greg138 |
I know this is a little old, but I wouldn't think it would cause this sort of issue. |
# |
Jul 27th 2021, 16:58 |
greg138 |
```intl Internationalization support => enabled ICU version => 64.2 ICU Data version => 64.2 ICU TZData version => 2019a ICU Unicode version => 12.1``` |
# |
Jul 27th 2021, 16:53 |
slackebot2 |
(/var/www/cake3/vendor/cakephp/cakephp/src/I18n/Formatter/IcuFormatter.php:56)``` |