Logs for #cakephp

Page 10 of 36,247, showing 100 records out of 3,624,625 total, starting on record 901, ending on 1,000

# At Username Text
# Aug 15th, 09:58 ndm @jotpe You can authorize against anything that your policy resolvers can provide a policy for... with the default ORM resolver you can authorize entities, tables, and queries (which is basically tables). So you may want to look into a table policy.
# Aug 15th, 09:58 slackebot <challgren>
# Aug 15th, 09:55 slackebot <neon1024>
# Aug 15th, 09:54 challgren cake 2.x??
# Aug 15th, 09:15 neothermic (in cake2)
# Aug 15th, 09:15 neothermic is there any way to get Cakelog::write to not echo to stdout when running unit tests?
# Aug 15th, 09:14 lubos @admad found the reason, when you do `formatResults` with finder on associated model (e.g. Offers) it sets `offer` property as dirty even when no change is done to `$results` so later on when I tried to save it was trying to save `offer` property which I did not expect :slightly_smiling_face:
# Aug 15th, 09:09 neon1024 Ah, I knew if I asked, I’d find it right away! https://github.com/dereuromark/cakephp-hashid
# Aug 15th, 09:09 neon1024 Anyone know where dereuromark’s plugin is which adds an obfuscation slug layer
# Aug 15th, 09:04 jotpe https://book.cakephp.org/authorization/1.1/en/checking-authorization.html -> there it's checked with the entity `$user->can('delete', $article)`
# Aug 15th, 09:03 jotpe In fact i want to enable an admin user to access all actions in a controller. But in an index action i don't have an entity
# Aug 15th, 09:02 jotpe How do i check the authorization for a index action in Authroization Plugin?
# Aug 15th, 08:41 spriz not afaik
# Aug 15th, 08:39 hmic oh, ah, does crud and crudview implement it on their own?
# Aug 15th, 08:38 hmic yeah, this paginator could use some serious love...
# Aug 15th, 08:38 hmic I need to report the total number back, it's API usage
# Aug 15th, 08:32 spriz the consumer just keeps doing `+1` to the `page` param, until a 404 is returned :)
# Aug 15th, 08:31 spriz we do that for heavy queries
# Aug 15th, 08:31 spriz or skip them :)
# Aug 15th, 08:31 spriz I made custom paginators a few time - it's not too much of a hassle :slightly_smiling_face:
# Aug 15th, 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, 08:29 admad https://github.com/cakephp/cakephp/blob/master/src/Datasource/Paginator.php#L185-L188
# Aug 15th, 08:29 hmic yep, i figured that :p :(
# Aug 15th, 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, 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, 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, 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, 08:17 admad trying to get proper count after query is done would be PITA
# Aug 15th, 08:17 admad hmic: i believe the best way would be do the filtering in query itself
# Aug 15th, 08:13 hmic I looked into mapReduce but can't figure that (and if it would solve the paginator count issue)
# Aug 15th, 08:12 hmic general question: how to filter results on a virtual field (and get correct counts from the paginator)?
# Aug 15th, 08:11 hmic any ideas?
# Aug 15th, 08:11 hmic I do understand the reason behind it and am looking for another solution now.
# Aug 15th, 08:10 hmic *but* there is a catch on this: the paginator count is wrong
# Aug 15th, 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, 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, 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, 07:28 admad if the db says data is too long for 255 chars than it must be
# Aug 15th, 07:27 lubos hmm, too difficult to explain, however the `formatResutls` is doing something odd :slightly_smiling_face:
# Aug 15th, 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, 07:10 admad why would a find operation try to save anything?
# Aug 15th, 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, 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, 06:41 mehov Found my SO answer from some time ago https://stackoverflow.com/a/52179717
# Aug 15th, 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, 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, 06:15 jotpe Morning
# Aug 15th, 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, 03:47 kailas getAlias()
# Aug 15th, 03:47 kailas thanks!
# Aug 15th, 03:47 kailas ah, getAlias is it
# Aug 15th, 03:46 zomb woops @kailas spelled your username wrong but ^^^
# Aug 15th, 03:45 zomb @kallas if you want the name of the table in the db, `$this->Orders->getTable()`
# Aug 15th, 03:45 zomb @kallas maybe try `$this->Orders->getAlias()` or `$this->Orders->getRegistryAlias()`
# Aug 15th, 03:41 kailas how can i get the name of the entity for a given table object? for example, in OrdersTable, $this->… would give me “Orders”?
# Aug 15th, 03:40 zomb quick question, is there a method for join/implode on the `Cake\Collection\Collection`
# Aug 15th, 00:35 challgren @pedroseco https://github.com/pronique/multitenant was a good plugin, it hasnt been updated in a while but I used it as a starting point
# Aug 14th, 23:31 pedroseco Hi guys. Im starting to build a SaaS using cakephp as the backend, but i’m a litlle lost on how to configure a multi-tenant app taking into account a different subdomain for each user
# Aug 14th, 20:05 ker Hi, someone try upload multiple image with proffer plugin? I follow the docs but doesn't work. So I have a table of products and another productsphotos and I want add multiple images when I add a new product.
# Aug 14th, 19:48 jh I am also using expose and ports keys
# Aug 14th, 19:48 jh command is --port in docker compose to get the port mapping going
# Aug 14th, 19:36 jh for debugging purposes of cake mail?
# Aug 14th, 19:31 shoe Sorry no :slightly_smiling_face: I use Mandrill or Postmarkapp for relaying mail… so much nicer.
# Aug 14th, 19:28 jh the mailhog config above should work but without smtp it makes no sense
# Aug 14th, 19:28 jh do you happen to have a working smtp server config for docker compose ;)?
# Aug 14th, 19:27 jh https://gist.github.com/inoas/8f6678e4bbe0a7eb949a7cd318dd0487 works now
# Aug 14th, 19:27 jh well i want custom ports so docker and redis have to know about it
# Aug 14th, 19:27 shoe Is it necessary in your docker-compose? Can’t you just specify it in the port section of your app.php config?
# Aug 14th, 19:26 jh aka specifying -p
# Aug 14th, 19:26 jh no idea why
# Aug 14th, 19:26 jh yeah I have been switching that around... but that just doesnt work
# Aug 14th, 19:25 jh which resulted in 2019-08-14T19:21:37.905705399Z 1:C 14 Aug 2019 19:21:37.905 # Fatal error, can't open config file '-p 6379'
# Aug 14th, 19:25 shoe Your error is that it’s trying to open port 6379, not 16379 like your docker-compose file exposes.
# Aug 14th, 19:25 jh shoe that was it I had command: -p 6379 in docker compose
# Aug 14th, 19:23 shoe Mine is fairly basic, I’ve got some setup happening in specific Docker files
# Aug 14th, 19:23 shoe https://gist.github.com/shoesole/b30b2e764d32e7082c5b19bfc52024d4
# Aug 14th, 19:22 jh # Fatal error, can't open config file '-p 6379' okok
# Aug 14th, 19:18 jh @shoe can you share yours
# Aug 14th, 19:14 jh that's my docker compose file
# Aug 14th, 19:13 jh shoe https://gist.github.com/inoas/8f6678e4bbe0a7eb949a7cd318dd0487
# Aug 14th, 19:12 rightscoreanalysis since upgrading to the latest 3.6.x version of cake my json routes no longer work
# Aug 14th, 19:11 jh can you show the docker compose snip
# Aug 14th, 19:11 jh redis is there now
# Aug 14th, 19:07 shoe I’ve been through that plenty of times!
# Aug 14th, 19:07 shoe :slightly_smiling_face:
# Aug 14th, 19:07 shoe I am using docker compose. redis is set as the host name there
# Aug 14th, 19:06 jh hm I may be just lacking php redis laughing out loud brb
# Aug 14th, 19:05 jh so no docker compose just one phat image?
# Aug 14th, 19:04 shoe Let me see if I have another one with that setup.
# Aug 14th, 19:04 shoe Nope didn’t map those ports (since it’s all internal to Docker in my case… No UN/PW on this setup.
# Aug 14th, 19:03 jh do you use username/password?
# Aug 14th, 19:03 jh and you didnt map any ports
# Aug 14th, 19:03 shoe In Docker, my redis host is called “redis”
# Aug 14th, 19:02 shoe ‘Cache’ => [ ‘default’ => [ ‘className’ => ‘Redis’, ‘duration’ => ‘+1 hours’, ‘prefix’ => ‘mg_redis_‘, ‘host’ => ‘redis’, ‘port’ => 6379, ‘groups’ => [‘orders’, ‘events’’], ‘fallback’ => ‘file’, ], ‘very_short’ => [ ‘className’ => ‘Redis’,
# Aug 14th, 19:02 slackebot ‘host’ => ‘redis’, ‘port’ => 6379, ‘fallback’ => ‘file_short’, ], ‘short’ => [ ‘className’ => ‘Redis’, ‘duration’ => ‘+10 minutes’, ‘prefix’ => ‘mg_redis_short_‘, ‘host’ => ‘redis’, ‘port’ => 6379, ‘fallback’ => ‘file_short’, ], ‘long’ => [
# Aug 14th, 19:02 slackebot ‘prefix’ => ‘mg_redis_long_‘, ‘host’ => ‘redis’, ‘port’ => 6379, ‘fallback’ => ‘file_long’, ],
# Aug 14th, 19:02 jh shoe thanks
# Aug 14th, 19:02 shoe @jh For what it’s worth: This is a Redis configuration from one of my projects:
# Aug 14th, 18:32 jh @steinkel could you share a simple RedisEngine config for app.php cause mine seems not to work (dockerized)
# Aug 14th, 18:31 jh Cache engine Cake\Cache\Engine\RedisEngine is not properly configured