Log message #4198183

# At Username Text
# Aug 15th 2019, 09:02 jotpe How do i check the authorization for a index action in Authroization Plugin?
# Aug 15th 2019, 08:41 spriz not afaik
# Aug 15th 2019, 08:39 hmic oh, ah, does crud and crudview implement it on their own?
# Aug 15th 2019, 08:38 hmic yeah, this paginator could use some serious love...
# Aug 15th 2019, 08:38 hmic I need to report the total number back, it's API usage
# Aug 15th 2019, 08:32 spriz the consumer just keeps doing `+1` to the `page` param, until a 404 is returned :)
# Aug 15th 2019, 08:31 spriz we do that for heavy queries
# Aug 15th 2019, 08:31 spriz or skip them :)
# Aug 15th 2019, 08:31 spriz I made custom paginators a few time - it's not too much of a hassle :slightly_smiling_face:
# Aug 15th 2019, 08:31 admad if those lines were rejigged a bit and the fetching of count was moved into separate method once could override that method and return count as per their custom needs
# Aug 15th 2019, 08:29 admad https://github.com/cakephp/cakephp/blob/master/src/Datasource/Paginator.php#L185-L188
# Aug 15th 2019, 08:29 hmic yep, i figured that :p :(
# Aug 15th 2019, 08:27 admad okay. currently `Paginator` just clones the primary query and does a `count()` on in instead of `all()` and everything is inside `Paginator::paginate()` so not very flexible
# Aug 15th 2019, 08:23 hmic filter all of them, of course. so the paginator calling ->count() can't be done on the query but the resulting collection only. i am aware of the imact of it. I am just looking for a place to add/configure it to work *at all(
# Aug 15th 2019, 08:21 admad i really don't see a solution to the problem.. how can you find out even the correct total count since the filtering of records would be done per page
# Aug 15th 2019, 08:18 hmic I am not able to get all the data this virtual field contains in the query/db, it represents external shit.
# Aug 15th 2019, 08:17 admad trying to get proper count after query is done would be PITA
# Aug 15th 2019, 08:17 admad hmic: i believe the best way would be do the filtering in query itself
# Aug 15th 2019, 08:13 hmic I looked into mapReduce but can't figure that (and if it would solve the paginator count issue)
# Aug 15th 2019, 08:12 hmic general question: how to filter results on a virtual field (and get correct counts from the paginator)?
# Aug 15th 2019, 08:11 hmic any ideas?
# Aug 15th 2019, 08:11 hmic I do understand the reason behind it and am looking for another solution now.
# Aug 15th 2019, 08:10 hmic *but* there is a catch on this: the paginator count is wrong
# Aug 15th 2019, 08:10 hmic I could manage to filter the data by utilizing formatResults and returning a new collection with the elements I don't want removed
# Aug 15th 2019, 08:09 hmic Hi, I am facing a problem with a query: I am using virtual fields and I need to filter my result by a virtual field now
# Aug 15th 2019, 07:32 lubos it is too long, but only when i trying to save data which were previously formated via `formatResults` :slightly_smiling_face:
# Aug 15th 2019, 07:28 admad if the db says data is too long for 255 chars than it must be
# Aug 15th 2019, 07:27 lubos hmm, too difficult to explain, however the `formatResutls` is doing something odd :slightly_smiling_face:
# Aug 15th 2019, 07:27 lubos sorry, my bad. when later on i try to save order entity, it throws DB error when I used `formatResults` with related `offer` property. When i skip the `formatResutls` with that `findDiscount` method, all OK
# Aug 15th 2019, 07:10 admad why would a find operation try to save anything?
# Aug 15th 2019, 07:05 slackebot findDiscount(Query $query, array $options) { $query ->formatResults(function ($results) ... ``` When I use this `formatResults` in the finder ORM is trying to save `offer` as json object which throws error (offer field varchar 255 exists in the orders table)
# Aug 15th 2019, 07:05 lubos Hey folks, facing interesting problem. there is finder in the `OffersTable` which I want to use with orders associated offer data So I have in the `OrdersController` ``` $this->Orders->find('allCreated') ->contain([ 'Offers' => function($q) { return $q ->find('discount') ... ``` and then the finder `discount` uses `formatResults` ``` public function
# Aug 15th 2019, 06:41 mehov Found my SO answer from some time ago https://stackoverflow.com/a/52179717
# Aug 15th 2019, 06:36 mehov Looks like an overkill now that I typed all this. Seemed like the least wrong way at the time though
# Aug 15th 2019, 06:32 mehov Had the same problem many times I just create a hidden method=post form (incudes all the necessary tokens) and then submit it via AJAX using jQuery.serialize() as request data I have most inputs as type=text, allows them to be edited via Javascript without triggering the form tampering prevention
# Aug 15th 2019, 06:15 jotpe Morning
# Aug 15th 2019, 05:43 spriz Morning everyone! For you guys running multiple web instances seperate from your db (eg. containers): How do you handle migrations that deletes columns in term of the ORM cache? We have removed all usage of the columns, is it safe to just delete it in our DB now?
# Aug 15th 2019, 03:47 kailas getAlias()
# Aug 15th 2019, 03:47 kailas thanks!
# Aug 15th 2019, 03:47 kailas ah, getAlias is it
# Aug 15th 2019, 03:46 zomb woops @kailas spelled your username wrong but ^^^