# |
Jun 1st 2021, 16:28 |
admad |
You don't have to manually add any hidden field |
# |
Jun 1st 2021, 16:27 |
tyler.adam.lazenby |
ok |
# |
Jun 1st 2021, 16:27 |
tyler.adam.lazenby |
oh |
# |
Jun 1st 2021, 16:27 |
tyler.adam.lazenby |
I didn't add that hidden field, let me see if it is there |
# |
Jun 1st 2021, 16:27 |
admad |
Just msg in channel instead of the unnecessary thread |
# |
Jun 1st 2021, 16:26 |
admad |
But html forms can only do POST so PUT is emulated using a hidden _method field |
# |
Jun 1st 2021, 16:26 |
tyler.adam.lazenby |
Not sure what you mean by this? |
# |
Jun 1st 2021, 16:25 |
admad |
And edit action is PUT in REST terms |
# |
Jun 1st 2021, 15:50 |
tyler.adam.lazenby |
The form method says "post" but the method from `$this->request->getMethod()` is saying it is "put" |
# |
Jun 1st 2021, 15:47 |
tyler.adam.lazenby |
I just saw that the method is "put" instead of "post". Why would my form be doing that? |
# |
Jun 1st 2021, 15:38 |
tyler.adam.lazenby |
```public function legacyConvert() { /** @var \App\Model\Entity\User|\Authentication\IdentityInterface $user */ $user = $this->Authentication->getIdentity(); if (!$user->is_admin) { $this->Flash->error('You are not authorized to view that.'); return $this->redirect('/'); } $users = $this->Accounts->Users->find(); $this->Authorization->applyScope($users, 'migrate'); if |
# |
Jun 1st 2021, 15:38 |
slackebot |
($this->request->is('post')) { debug('post received'); dd($this->request->getData()); } if ($users->count() === 0) { $this->Flash->warning('No users are found'); return $this->redirect(['controller' => 'Accounts', 'action' => 'index']); } // Passed data $fields = [ 'id', 'user_type_id', 'first_name', 'last_name', 'phone', 'email', |
# |
Jun 1st 2021, 15:38 |
slackebot |
'login', 'password', 'company_name', 'account_id' ]; $user_types = $this->Accounts->Users->UserTypes->find('list'); $accounts = $this->Accounts->find('list'); $this->set(compact('users', 'user_types', 'fields', 'accounts')); }``` |
# |
Jun 1st 2021, 15:38 |
tyler.adam.lazenby |
Ok this is really strange behavior. I am simply trying to make sure that the post conditional code is contained with a post request. I have a form with a submit button, and i verified that the form's method is post. But when I try to make a post request, the code inside the post check isn't executed. |
# |
Jun 1st 2021, 12:41 |
paolo.bragagni |
hot to set date and numbers in italian (I mean dd/gg/YYYY) in search plugin? |
# |
Jun 1st 2021, 12:40 |
paolo.bragagni |
How to search between date with https://github.com/FriendsOfCake/search ? |
# |
Jun 1st 2021, 10:39 |
inoas |
We miss you over at irc.libra.chat after FN has been taken over by some billionaire - As it is forbidden to put this in a topic, I am certain posting this once in a while in the chat here is a good free speech measure of making sure we don't break up as a community |
# |
Jun 1st 2021, 09:55 |
paolo.bragagni |
ecc.. |
# |
Jun 1st 2021, 09:55 |
paolo.bragagni |
{% for field in fields %} {%- if propertySchema[field]['type'] in ['date', 'datetime', 'time'] %} |
# |
Jun 1st 2021, 09:55 |
paolo.bragagni |
done |
# |
Jun 1st 2021, 08:33 |
paolo.bragagni |
cant get the schema in my table.twig so cant use Bake.columnData(field, schema) to retrieve filedData |
# |
Jun 1st 2021, 07:57 |
kevin.pfeifer |
ah, good to know! thx |
# |
Jun 1st 2021, 07:55 |
jpramirez |
@kevin.pfeifer if you use the test suite light, you can activate the statistic tool, which will give you also information on how many tables were involved in your test, which you want low in order to speed up your tests. But `--log-junit` will definitely do the job. |
# |
Jun 1st 2021, 06:59 |
paolo.bragagni |
put this in my table.twig but it doesnt find the schema |
# |
Jun 1st 2021, 06:59 |
paolo.bragagni |
{% for field in fields %} {%- set fieldData = Bake.columnData(field, schema) %} |
# |
May 31st 2021, 17:23 |
kevin.pfeifer |
pretty nice |
# |
May 31st 2021, 17:23 |
kevin.pfeifer |
doing `phpunit --colors=always --log-junit "my_tests_log.xml"` also generates a XML which also contains the time for each function :) |
# |
May 31st 2021, 17:21 |
steinkel |
`time vendor/bin/phpunit --filter yourTest` :P |
# |
May 31st 2021, 17:17 |
kevin.pfeifer |
uh, didn’t think of the xdebug profiler :thinking_face: |
# |
May 31st 2021, 17:17 |
ndm |
Run the test suite with xdebug profiling enabled, or for some more caveman-ish approach, start a timer in `setup()` and stop and log it in `teardown()`. |
# |
May 31st 2021, 17:11 |
kevin.pfeifer |
so not the whole test-suite, more granular for each test |
# |
May 31st 2021, 17:10 |
kevin.pfeifer |
Is there an “easy” way to measure how long a phpunit test takes? I got the problem, that some of my tests take pretty long, but I don’t know which and going through over 700 tests can take quite some time. |
# |
May 31st 2021, 13:33 |
paolo.bragagni |
Thanks |
# |
May 31st 2021, 13:31 |
ndm |
Most likely. |
# |
May 31st 2021, 13:30 |
dereuromark |
isnt that done via Bake helper columnData() ? https://github.com/dereuromark/cakephp-setup/blob/master/templates/bake/element/form.twig#L44 |
# |
May 31st 2021, 13:29 |
paolo.bragagni |
I'd like to get name and type of fields |
# |
May 31st 2021, 13:29 |
paolo.bragagni |
Ive done this |
# |
May 31st 2021, 13:29 |
paolo.bragagni |
{%- if validation %} //PB per search $this->addBehavior('Search.Search'); $this->searchManager() {% for field in validation %} ->add('{{ field }}', 'Search.Like', [ 'before' => true, 'after' => true, 'mode' => 'or', 'comparison' => 'LIKE', 'wildcardAny' => '*', |
# |
May 31st 2021, 13:29 |
slackebot |
'wildcardOne' => '?', 'fields' => ['{{ field }}'], ]) {% endfor %} ; //End PB {% endif %} |
# |
May 31st 2021, 13:28 |
ndm |
I'm afraid I don't understand what exactly you're trying to do. You're looking for "field details"? |
# |
May 31st 2021, 13:26 |
paolo.bragagni |
fields |
# |
May 31st 2021, 13:26 |
paolo.bragagni |
how to get field (in detail)? |
# |
May 31st 2021, 13:26 |
paolo.bragagni |
validation |
# |
May 31st 2021, 13:26 |
ndm |
sorry, what? |
# |
May 31st 2021, 13:25 |
paolo.bragagni |
but how to disconnect to valodaton?? |
# |
May 31st 2021, 13:25 |
paolo.bragagni |
ecc ecc |
# |
May 31st 2021, 13:25 |
paolo.bragagni |
{%- if validation %} //PB per search $this->addBehavior('Search.Search'); $this->searchManager() {% for field in validation %} |
# |
May 31st 2021, 13:22 |
ndm |
@paolo.bragagni There should be a variable named `fields` containing all the columns of the related schema. |
# |
May 31st 2021, 13:17 |
kevin.pfeifer |
@massimoi it depends on what your virtual field is called. e.g. `$entity->duedate_with_days_diff` would need that in your entity.php ``` public function _getDuedateWithDaysDiff(): string { return 'Date: ' . $this->date . ' - due in: ' . $this->duedays; }``` |
# |
May 31st 2021, 13:12 |
paolo.bragagni |
someone knows how to get fields (name and type) in table.twig? |
# |
May 31st 2021, 13:05 |
ndm |
I do what I can, but let's not get carried away here :) |
# |
May 31st 2021, 12:29 |
massimoi |
any idea if I'm doing something wrong or if this is the requested |
# |
May 31st 2021, 12:28 |
massimoi |
@kevin.pfeifer, ok but when I do a $this->Model->find() I would expect to have the virtual fields, while they are empty |
# |
May 31st 2021, 11:35 |
kevin.pfeifer |
virtualFields are on the entities, not on the table object itself |
# |
May 31st 2021, 11:32 |
massimoi |
Hi, a simple question. We have Model with some virtualFields, is it normal that when I use the $this->loadModel the virtualFields are not accessible ? |
# |
May 31st 2021, 11:20 |
amanda.goff |
Hey Rian! Our team of devs at CakeDC could definitely help. If you’d like. Shoot me an email at Amanda.goff@cakedc.com |
# |
May 31st 2021, 11:17 |
kevin.pfeifer |
ok, thx :) |
# |
May 31st 2021, 11:17 |
dereuromark |
jep, I dont think there is a way around that other than extending form helper to auto do that |
# |
May 31st 2021, 11:14 |
slackebot |
fieldname with the corresponding text domain instead of the root app domain? Or do I now have to add a bunch of `'label' => __d('my_plugin', 'Name')` into my fields? |
# |
May 31st 2021, 11:14 |
kevin.pfeifer |
One Question about translations in plugins I now moved a bunch of Code incl. templates into a plugin. Everything works pretty good but before (in the root app) the label for e.g. the input `$this->Form->control( 'name' )` was automatically translated without the need to set the `label` key. Now in my plugin i use `__d('my_plugin', 'Name')` to translate a given text. What do I have to tell my FormHelper to translate a |
# |
May 31st 2021, 10:46 |
paolo.bragagni |
Hi in table.twig how to get the fields name (I'd like to use the search plugin for all fields) |
# |
May 31st 2021, 08:35 |
rian.orie |
Howdy folks. If I were to look for a freelancer with a solid amount of experience with cake, where would I look? |
# |
May 31st 2021, 06:52 |
k4t |
from my point of view everything looks fine, I also see thet whole authentication process is applied and request during it is poprulated with Identify object. But after exception is thrown and everything is get lost. |
# |
May 31st 2021, 06:45 |
k4t |
checking |
# |
May 31st 2021, 06:44 |
hmic |
Be aware that the error might happen in your middleware queue before auth is even applied# |
# |
May 31st 2021, 06:44 |
hmic |
I don't see it handling Auth different from other Controllers, so I think you need to make sure it's beeing applied, Application.php, routes.php, whereever you set it up, besides the (App)Controller |
# |
May 31st 2021, 06:44 |
k4t |
@admad any ideas? |
# |
May 31st 2021, 06:43 |
k4t |
that is what what is inside of request attributes field, there should be also additional field Identity |
# |
May 31st 2021, 06:43 |
slackebot |
<k4t> |
# |
May 31st 2021, 06:43 |
k4t |
Generally from some reason it looks like that when error happens (e.g. user opening 404 page) than request object is not populated with Identity data |
# |
May 31st 2021, 06:42 |
hmic |
I see. Just be aware of what I just mentioned, as it will break hard. |
# |
May 31st 2021, 06:35 |
k4t |
Customer wants to display "Login" button on some error pages and it does not make sens to display them when use is logged in |
# |
May 31st 2021, 06:33 |
hmic |
Side note, do you think it's a good idea? If something with Authentication is wrong, the error will not be rendered at all then... |
# |
May 31st 2021, 06:32 |
k4t |
``` public function initialize(): void { $this->loadComponent('Authentication.Authentication'); }``` |
# |
May 31st 2021, 06:32 |
k4t |
Yes |
# |
May 31st 2021, 06:31 |
hmic |
k4t: is the ErrorsController setup to use authentication? |
# |
May 31st 2021, 06:30 |
k4t |
Hi all, can anybody tell me why $this->Identity->isLoggedIn() function always returns FALSE when it is used inside of /Error/error400.php template? Even if user is logged in it will return FALSE for example when user is trying to open 404 url. Latest CakePHP 4 is used. |
# |
May 30th 2021, 16:04 |
kevin.pfeifer |
indeed |
# |
May 30th 2021, 16:00 |
etibor |
and one more thing selflesnes always brings selflesnes |
# |
May 30th 2021, 16:00 |
etibor |
i think the first one is the worst one, became familier with the concept will help |
# |
May 30th 2021, 15:14 |
kevin.pfeifer |
but you get into it after some time ;) |
# |
May 30th 2021, 15:14 |
kevin.pfeifer |
the whole validation process can be quite complex :) |
# |
May 30th 2021, 15:13 |
kevin.pfeifer |
:+1::the_horns: |
# |
May 30th 2021, 15:13 |
etibor |
thank you very much your time, help end effort |
# |
May 30th 2021, 15:13 |
etibor |
thank you now i can say its working totally |
# |
May 30th 2021, 15:13 |
etibor |
:pray: |
# |
May 30th 2021, 15:08 |
kevin.pfeifer |
but this all basically depends on what "logic" you want to implement |
# |
May 30th 2021, 15:07 |
kevin.pfeifer |
otherwise you still get the error |
# |
May 30th 2021, 15:07 |
kevin.pfeifer |
```if(!empty($frat->_joinData->score )){ if( $frat->_joinData->score > $frat->maximal || $frat->_joinData->score<1 ){ } } ``` |
# |
May 30th 2021, 15:06 |
kevin.pfeifer |
so you would need something like that |
# |
May 30th 2021, 15:06 |
kevin.pfeifer |
|| doesn't "break" at first |
# |
May 30th 2021, 15:06 |
kevin.pfeifer |
ah wait |
# |
May 30th 2021, 15:04 |
kevin.pfeifer |
```if( !empty($frat->_joinData->score ) || $frat->_joinData->score > $frat->maximal || $frat->_joinData->score<1 ){``` |
# |
May 30th 2021, 15:03 |
kevin.pfeifer |
it checks each value "if-part" one after the other |
# |
May 30th 2021, 15:03 |
kevin.pfeifer |
put the !empty at first |
# |
May 30th 2021, 15:02 |
etibor |
if($frat->_joinData->score > $frat->maximal || $frat->_joinData->score<1 || !empty($frat->_joinData->score )){ |
# |
May 30th 2021, 15:01 |
etibor |
its shows the validation custom error message |
# |
May 30th 2021, 15:00 |
kevin.pfeifer |
what error do you get |
# |
May 30th 2021, 15:00 |
etibor |
this is what i used : !empty($frat->_joinData->result) |
# |
May 30th 2021, 14:57 |
kevin.pfeifer |
and the field the one which you want to check |