# |
Jan 13th 2020, 13:57 |
dereuromark |
sure, multiple options, including entity route |
# |
Jan 13th 2020, 13:55 |
k4t |
Hey, my customer want to change slug so urls with old slug wont work anymore. Is it possible to handle redirect from old urls to new ones without making new Routing class? |
# |
Jan 13th 2020, 13:19 |
jtraulle |
thx @admad |
# |
Jan 13th 2020, 13:09 |
admad |
@jtraulle separation of concern |
# |
Jan 13th 2020, 13:04 |
challgren |
https://github.com/cakephp/cakephp/blob/master/src/Controller/Component/SecurityComponent.php#L40 |
# |
Jan 13th 2020, 13:04 |
jtraulle |
just seen https://book.cakephp.org/4/en/appendices/4-0-migration-guide.html#component |
# |
Jan 13th 2020, 13:04 |
jtraulle |
Okay, thanks |
# |
Jan 13th 2020, 13:03 |
challgren |
SecurityComponent is deprecated |
# |
Jan 13th 2020, 13:03 |
jtraulle |
SecurityComponent already provide form data tampering protection so I do not really understand what the purpose of FormProtectionComponent is ... |
# |
Jan 13th 2020, 13:02 |
jtraulle |
Anyone know the difference between SecurityComponent and FormProtectionComponent in 4.x ? |
# |
Jan 13th 2020, 13:02 |
jtraulle |
Hello everyone :wave: |
# |
Jan 13th 2020, 12:50 |
HumanG33k |
Hello |
# |
Jan 13th 2020, 12:28 |
javier.villanueva |
;) |
# |
Jan 13th 2020, 12:27 |
admad |
Si |
# |
Jan 13th 2020, 12:26 |
javier.villanueva |
This is a good option ? :point_up_2: |
# |
Jan 13th 2020, 12:24 |
javier.villanueva |
```$articles->getConnection()->transactional(function () use ($articles, $entities) { $article = $articles->newEntity(); });``` |
# |
Jan 13th 2020, 12:22 |
javier.villanueva |
If I want save an entity and after link related data with it, wich is the best way to make it transactional (just in case related fails)? |
# |
Jan 13th 2020, 11:30 |
neon1024 |
@tjkalinowski I am curious why you talk in code |
# |
Jan 13th 2020, 11:18 |
dereuromark |
If the sniff exists, this seems to be a path problem then. it cannot find the other sniff repos. |
# |
Jan 13th 2020, 11:18 |
tjkalinowski |
```Why ordering is not working?``` |
# |
Jan 13th 2020, 11:17 |
neon1024 |
Yep, seems to be 4.x issue |
# |
Jan 13th 2020, 11:14 |
dereuromark |
probably. |
# |
Jan 13th 2020, 11:13 |
neon1024 |
Is this because I’m on 4.0.0 of the sniffer? |
# |
Jan 13th 2020, 11:11 |
neon1024 |
I setup cakephp/cakephp-codesniffer and configured it in phpstorm and get this all the time. Anyone have any ideas? |
# |
Jan 13th 2020, 11:00 |
dereuromark |
those are still the same tool (the first), all the same. |
# |
Jan 13th 2020, 10:57 |
challgren |
My cs-check is `vendor/bin/phpcs --colors -p --standard=vendor/cakephp/cakephp-codesniffer/CakePHP --runtime-set ignore_warnings_on_exit true --extensions=php --ignore=tests/test_files/,config/Seeds/,config/Migrations/ src/ tests/ config/` and my cs-fix is `vendor/bin/phpcbf --colors -p --standard=vendor/cakephp/cakephp-codesniffer/CakePHP --extensions=php --ignore=tests/test_files/ src/ tests/ config/` |
# |
Jan 13th 2020, 10:56 |
neon1024 |
Which is a standard for the squizlabs one ;) |
# |
Jan 13th 2020, 10:55 |
challgren |
Theres also https://github.com/cakephp/cakephp-codesniffer |
# |
Jan 13th 2020, 10:50 |
dereuromark |
phpcsfixer has a few bad practices IMO in terms of exdendability (prevention), and is sometimes a bit too opininated in a bad way). So most still use the first. |
# |
Jan 13th 2020, 10:44 |
neon1024 |
As PHPCS comes with PHPCBF for fixing |
# |
Jan 13th 2020, 10:44 |
neon1024 |
What are the differences between https://github.com/FriendsOfPHP/PHP-CS-Fixer and https://github.com/squizlabs/PHP_CodeSniffer |
# |
Jan 13th 2020, 08:13 |
javier.villanueva |
morning all |
# |
Jan 13th 2020, 07:05 |
hanumanprasad.yadav |
Thanks @admad |
# |
Jan 13th 2020, 06:54 |
admad |
yes something like that |
# |
Jan 13th 2020, 06:53 |
hanumanprasad.yadav |
Ok, then we need to user this: https://book.cakephp.org/3/en/orm/query-builder.html#subqueries right? |
# |
Jan 13th 2020, 06:53 |
admad |
and to get `exists` you'll probably need to use query expressoin |
# |
Jan 13th 2020, 06:51 |
admad |
so you need subqueries, hence forget matching() as it does joins. The book has examples for using sub queries |
# |
Jan 13th 2020, 06:47 |
hanumanprasad.yadav |
@admad please check below simple query example for above requirement: select * from `users` where exists (select * from `listings` where `users`.`id` = `listings`.`user_id`) or exists (select * from `organizations` where `users`.`id` = `organizations`.`user_id`) |
# |
Jan 13th 2020, 06:33 |
admad |
step 1: come up with the SQL query needed to achieve what you want |
# |
Jan 13th 2020, 06:24 |
slackebot |
solution about this type of query |
# |
Jan 13th 2020, 06:24 |
slackebot |
this case if anyone listing available then we need result and also anyone Organizations available then we need result but if both Listings or Organizations not available then we don't need result. Current query: $query = $this->Users->find(); $query->matching('Listings'); $query->matching('Organizations'); I need like this: $query = $this->Users->find(); $query->matching('Listings'); $query->orMatching('Organizations'); Please help me if have any |