Log message #4265150

# At Username Text
# Jun 11th 2021, 08:32 slackebot `'button' => '<button{{attrs}}>{{text}}</button>',`         `'checkbox' => '<input class="form-check-input" type="checkbox" name="{{name}}" value="{{value}}"{{attrs}}>',`         `'checkboxFormGroup' => '<label for="{{text}}" class="form-label">{{text}}</label>',`         `'checkboxWrapper' => '<div class="form-check">{{label}}</div>',`         `'checkboxContainer' => '<div
# Jun 11th 2021, 08:32 tomrwaller Hey guys - in an attempt to avoid having to re-invent the wheel, I was wondering if anyone happened to have a Bootstrap 5 Form Helper template they are williing to share. The one I have is still Bootstrap 4 and things have changed a fair bit. Below is what I have already. Anyone able to share? Or even point me to one online? I've looked around quite a lot but had no joy so far. `<?php`      `return [`        
# Jun 11th 2021, 08:27 kevin.pfeifer definitely :)
# Jun 11th 2021, 08:27 paolo.bragagni :)
# Jun 11th 2021, 08:27 paolo.bragagni (I was near)
# Jun 11th 2021, 08:26 paolo.bragagni thanks
# Jun 11th 2021, 08:23 kevin.pfeifer ```$type = $this->Categories->getSchema()->getColumnType('id');```
# Jun 11th 2021, 08:19 paolo.bragagni in cake 2 I did this
# Jun 11th 2021, 08:19 paolo.bragagni $this->loadModel($model); $tipo_colonna = $this->$model->getColumnType($field);
# Jun 11th 2021, 08:19 paolo.bragagni in cake4 how to get the coloumn type of a filed?
# Jun 11th 2021, 08:17 ovidiu.marinoiu cool, thanks!
# Jun 11th 2021, 08:16 kevin.pfeifer @ovidiu.marinoiu you can get the “parent” Controller (from which you use the component) via `$controller = $this->getController();` Then you can access the model via that variable as if you were in the controller `$controller->MyModel->find()` But components are meant to be used by multiple controllers so you don’t always have the same controller
# Jun 11th 2021, 08:05 ovidiu.marinoiu Hi! how can I import a model, in cakephp4, in a component. Found that in previous versions it was possible using ClassRegistry.
# Jun 11th 2021, 05:17 paolo.bragagni (trying to make template with search function for index view)
# Jun 11th 2021, 05:16 paolo.bragagni I have to built call back function that tests if input is numeric, or there are other easy ways?
# Jun 11th 2021, 05:15 paolo.bragagni but if user enter string value I got an error
# Jun 11th 2021, 05:15 paolo.bragagni $this->searchManager() ->add('numero_scaffale', 'Search.Value', [ 'fields' => ['numero_scaffale'],
# Jun 10th 2021, 22:17 jpramirez Ah O.K. so this is not a unit test, because you are not testing your model domain, but the interaction with the outer world from your app's perspective. I am saying this only to remind you to write unit tests, and not only some let's call them end to end tests. When interacting with an API, your only chance is to mock the contract with your API. Does this make sense to you?
# Jun 10th 2021, 22:08 tyler.adam.lazenby The the refresh token you save to prevent you from doing that
# Jun 10th 2021, 22:08 tyler.adam.lazenby Its because Google OAuth only allows you to refresh a token 5 times within a given period of time
# Jun 10th 2021, 22:07 jpramirez Can you re-explain your question @tyler.adam.lazenby ? A unit test that works five time only is a cheap one :smiling_face_with_tear:
# Jun 10th 2021, 21:36 tyler.adam.lazenby Really complicated question here. I am testing with oAuth connections, and unit testing the token with my test database works 5 times until the max number of refresh tokens allowed for a client are met. How would you go about making sure that once a refresh token is saved, that the fixture itelf accepts that?
# Jun 10th 2021, 18:44 tyler.adam.lazenby I mean, I get it the route collection ensures have the collection ready to go
# Jun 10th 2021, 18:43 admad Smart :)
# Jun 10th 2021, 18:42 tyler.adam.lazenby that is what I got it from :P
# Jun 10th 2021, 18:42 admad That's essentially what's used to parse the current request url too :)
# Jun 10th 2021, 18:38 greg138 In 3.x, at least, it seems that `loadRoutes` is called by any router function that might need them, like `url`.
# Jun 10th 2021, 18:38 kevin.pfeifer thats cool, didn’t know that :thinking_face:
# Jun 10th 2021, 18:36 kevin.pfeifer routes are definitely not loaded by default
# Jun 10th 2021, 18:35 tyler.adam.lazenby ```public function sendEmail() { $this->Authorization->skipAuthorization(); $referrer = $this->request->referer(); $params = Router::getRouteCollection()->parse($referrer); return $this->response->withDisabledCache() ->withType('application/json') ->withStringBody(json_encode([ 'url' => $referrer, 'params' => $params ])); }```
# Jun 10th 2021, 18:34 kevin.pfeifer `Cake\TestSuite\TestCase` yes
# Jun 10th 2021, 18:34 tyler.adam.lazenby but I think I just figured out a way
# Jun 10th 2021, 18:34 tyler.adam.lazenby Just the refering url
# Jun 10th 2021, 18:33 greg138 I've never needed to do this. Are you extending Cake's `TestCase` class?
# Jun 10th 2021, 18:29 kevin.pfeifer if so then you have everything in this array ```$params = $this->getRequest()->getAttribute('params');```
# Jun 10th 2021, 18:28 kevin.pfeifer do you have a request object where you want to do that?
# Jun 10th 2021, 18:22 tyler.adam.lazenby I know you can reverse an array into a string, but I can't seem to figure out how to take the referer url and make it something my system can use
# Jun 10th 2021, 18:22 tyler.adam.lazenby Is there a method for taking apart a url and seperating it into its Router elements?
# Jun 10th 2021, 18:06 tyler.adam.lazenby yay! finally got it to spit out the referer
# Jun 10th 2021, 17:55 tyler.adam.lazenby thanks
# Jun 10th 2021, 17:55 tyler.adam.lazenby I was looking for something like that