Log message #4190429

# At Username Text
# Jun 21st 2019, 07:35 graziel in newer i think yes, https://github.com/cakephp/app/blob/master/config/routes.php#L58
# Jun 21st 2019, 07:27 nuzulfikrie my question now is does CAKEPHP CSRF is enabled by default ? .
# Jun 21st 2019, 07:26 nuzulfikrie disabling this line 'code' $this->loadComponent('Csrf'); 'code' resolve error.
# Jun 21st 2019, 07:26 nuzulfikrie hi team, need help. i am having ' CRSF token mismatch error ' on delete action.
# Jun 21st 2019, 06:49 conehead Good morning everyone
# Jun 21st 2019, 06:09 noypi2020 Hi, Good day! mod_rewrite is enabled on the server and the .htaccess files were intact. I cannot figure out where to fix those errors.
# Jun 21st 2019, 04:19 joey.mukherjee Looks like this works! In case someone else searches for it: ` $routes->connect ('/:uuiid', ['controller' => 'Plots', 'action' => 'view']) ->setPatterns (['uuid' => '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}']);`
# Jun 21st 2019, 04:11 joey.mukherjee Is there a better way of capturing a UUID from the url?
# Jun 21st 2019, 04:03 joey.mukherjee I copied directly from that page in the book! That's how I got the errors. Ok, I also have this: `$routes->connect ('/**', ['controller' => 'Plots', 'action' => 'view']);` I need that since I want to pass a UUID on the url?
# Jun 21st 2019, 03:59 mrfeedback @joey.mukherjee https://book.cakephp.org/3.0/en/development/routing.html#prefix-routing
# Jun 21st 2019, 03:59 challgren Just do something like this @joey.mukherjee
# Jun 21st 2019, 03:57 joey.mukherjee question about admin routing... If I want an admin prefix, I add ```Router::prefix('admin', function (RouteBuilder $routes) { $routes->connect ('/', ['controller' => 'admin', 'action' => 'index']);
# Jun 20th 2019, 20:04 ricksaccous I think it's because I'm not using the OrmPolicy but the mapper policy which runs in the middleware before the controller is hit
# Jun 20th 2019, 19:59 ricksaccous is not stopping the policy from happening
# Jun 20th 2019, 19:59 ricksaccous my skipAuthorization method from my component
# Jun 20th 2019, 19:59 ricksaccous hmmm
# Jun 20th 2019, 19:53 ricksaccous actually i think i'll be fine pushing them back to their dashboard
# Jun 20th 2019, 19:52 ricksaccous i suppose i'll just have to write a handle that extends redirect
# Jun 20th 2019, 19:41 ricksaccous hmm
# Jun 20th 2019, 19:41 ricksaccous there must be an easy way to redirect to referer
# Jun 20th 2019, 19:40 ricksaccous https://book.cakephp.org/authorization/1.1/en/middleware.html#handling-unauthorized-requests
# Jun 20th 2019, 18:06 mdotobie gotcha. well this actually might be a better way to do this
# Jun 20th 2019, 18:05 admad Webservice is akin to db connection and Driver is akin to pdo driver
# Jun 20th 2019, 18:04 admad Endpoint is akin to Table and Resource is akin to Entity
# Jun 20th 2019, 18:02 mdotobie Any insight on the difference between Endpoint and Resource?
# Jun 20th 2019, 18:00 admad Endpoint is your model abstraction. You would create a driver which reads the json file instead of making a GET request
# Jun 20th 2019, 17:59 mdotobie The other thing I would have wanted to add @admad would be a way to define the schema of the loaded data for validation purposes (since it’s handwritten). But I really liked the _transformResults method it has for parsing the JSON, however, I’m basically using `JsonConfig` through the `Configure` class to perform the same function.
# Jun 20th 2019, 17:57 mdotobie @admad on this particular use the JSON is written by hand in advance it isn’t coming from a service. But I was thinking about how I could extend it in the future. I did come across Webservice when I was researching if what I was trying to do was possible and how would I architect it. My only question was around whether an “endpoint” could be a file or was a URL you’re only option.
# Jun 20th 2019, 17:52 admad @mdotobie if you are fetching data from an external API is suggest you checkout muffin/webservice
# Jun 20th 2019, 17:48 mdotobie I think a really good way I intend to extend this is for caching JSON data from sources. Then the cached JSON can be read in as config data and can be updated on a schedule or on demand. But it doesn’t need to be retrieved fresh on each request because it won’t change often.
# Jun 20th 2019, 17:46 mdotobie I think I like this architecture.
# Jun 20th 2019, 17:46 slackebot1 `\App\Model\Table` namespace as `ShippingItemTable`. Instead of extending `\Cake\ORM\Table` like a normal Table, it extends `App\Model\Datasource\Json`. In turn, the Entity is in the `\App\Model\Entity` namespace as `ShippingItem`
# Jun 20th 2019, 17:46 mdotobie Hey @jeremyharris, although I know I haven’t provided alot of context, I wanted to point out that as I sat here working on this I’ve decided to move the `\App\Model\Json\Json` to `App\Model\Datasource\Json`. My first experimental subclasses of this is a definition JSON file for Shipping Carrier data, the data lives in `config` and the “table” originally lived in the `\App\Model\Json` namespace as `ShippingJson` but it’s now mixed
# Jun 20th 2019, 16:27 jeremyharris same!
# Jun 20th 2019, 16:26 mdotobie okay. sometimes I like to do a sanity check to see if the way I’m thinking about things actually makes sense. I’m prone to over-engineering…but I like the mental stretching it gives to learn how to approach problems in non-obvious ways.
# Jun 20th 2019, 16:26 jeremyharris no need to make the developer learn their API if they don’t have good typehinted clients
# Jun 20th 2019, 16:25 jeremyharris yeah in those cases it makes sense to me to wrap them
# Jun 20th 2019, 16:25 jeremyharris if you need that level of abstraction then that’s fine. Sometimes it’s not necessary, because in reality your application is tied to those APIs even after the abstraction. I guess it depends on what the service class is doing
# Jun 20th 2019, 16:25 mdotobie Well, when that API doesn’t have a straightforward API. For instance I use the Mandrill PHP library as is, but I do a lot of custom stuff to Slack so I have a SlackService class that uses the Slack API directly through Guzzle injected into the Service class.
# Jun 20th 2019, 16:23 mdotobie I actually do something I refer to as Service classes as wrappers to API libraries.
# Jun 20th 2019, 16:22 slackebot1 “importers” and the `Hash` class as the data extractor.