Logs for #cakephp

Page 10 of 36,349, showing 100 records out of 3,634,849 total, starting on record 901, ending on 1,000

# At Username Text
# Oct 11th, 23:51 challgren @damiano https://packagist.org/packages/hayko/mongodb
# Oct 11th, 23:20 damiano can we use MongoDB with Cakephp 3.8?
# Oct 11th, 23:19 damiano hi
# Oct 11th, 22:11 asdfgh hello, do you know a good plugin to compress html/css ?
# Oct 11th, 22:06 kazunanakama my Posts entity already has a _getAuthor() and _getParentThread() function
# Oct 11th, 22:05 kazunanakama how would I pass those two things?
# Oct 11th, 22:05 kazunanakama like $forum->latest_post($project->id, $forum->id)
# Oct 11th, 22:04 kazunanakama but I need to pass the project as well
# Oct 11th, 22:03 kazunanakama or $forum->latest_post->parent_thread->title
# Oct 11th, 22:03 kazunanakama I want something like $forum->latest_post->author->username
# Oct 11th, 22:02 kazunanakama and how do I also include that posts author object(user) and the parent thread?
# Oct 11th, 22:01 kazunanakama how to I call that from a view?
# Oct 11th, 22:01 kazunanakama ``` public function getLatestPost($project_id, $forum_id){ $this->Posts = TableRegistry::get('Posts'); return $this->Posts->find('all', [ 'order' => ['Posts.created' => 'DESC'] ])->where(['project_id' => $project_id, 'forum_id' => $forum_id])->first(); }```
# Oct 11th, 22:01 kazunanakama ` public function getLatestPost($project_id, $forum_id){ $this->Posts = TableRegistry::get('Posts'); return $this->Posts->find('all', [ 'order' => ['Posts.created' => 'DESC'] ])->where(['project_id' => $project_id, 'forum_id' => $forum_id])->first(); }`
# Oct 11th, 22:01 kazunanakama So I have this in my Forum Table Model:
# Oct 11th, 21:58 kazunanakama but I also want it for a specific project
# Oct 11th, 21:58 kazunanakama I want my forum to have a "Latest Post" feature with the parent thread title, the last user that posted, and the time they posted at
# Oct 11th, 21:57 kazunanakama I want to know if there is a good way that I can find the latest post in a thread
# Oct 11th, 21:56 kazunanakama So I tried this a different way, but I have Projects, ForumCategories, Forums, Threads, and Posts
# Oct 11th, 20:07 tobse @this.impetus Silly question: did you already had a look for migrations? Maybe the project was developed using migrations. So it would be very easy to rebuild the database.
# Oct 11th, 18:36 slackebot1 <ron.rattie>
# Oct 11th, 18:35 this.impetus yeah, all of it, just... by hand haha. ok, cheers guys, I think if there were an easy solution here i'd have prompted it by now, thanks for reading
# Oct 11th, 18:34 ron.rattie should be able to glean some of the tables and relations by looking at the models
# Oct 11th, 18:34 this.impetus like I said, this is for a small academic lab. rewriting the tables by hand is like... one day. but it occured to me that all of this is info in implicitly modelled my cake, so, I was jut curious if there wwere a script somewhere in the cake CLI that could help
# Oct 11th, 18:32 ron.rattie that sucks
# Oct 11th, 18:32 this.impetus just me
# Oct 11th, 18:32 ron.rattie anyone working on the project not working directly on the db? they would have had a copy or a dump file
# Oct 11th, 18:32 this.impetus oh, no, if someone had to have done then it was me, and I periodically do this, but not since this project began, foolishly
# Oct 11th, 18:32 ron.rattie basically someone may have dumped the database or some tables into a .sql file
# Oct 11th, 18:32 this.impetus honestly guys I got phpmyadmin running and then never looked back, this isn't my jam at all
# Oct 11th, 18:31 this.impetus sql dumps—I've heard this phrase, point me to a path and I shall explore. backups will begin post-reinstall, I assure you :cold_sweat:
# Oct 11th, 18:30 ron.rattie backups? sql dumps ?
# Oct 11th, 18:30 this.impetus everyone has logged out of everything and changed their passwords, etc.,
# Oct 11th, 18:27 this.impetus I don't know—I am managing this small, academic server, I'm pretty unqualified to do so, I'm a front-end dev who got roped into a fullstack gig. we are literally going to just nuke the drive and reinstall
# Oct 11th, 18:26 itmpls how did you . have a databreach if you dont mind me asking
# Oct 11th, 18:24 this.impetus Hey guys—is there way to rebuild a MySQL database from the a cakephp project? I had a databreach yesterday and all our tables were replaced with ransom notes. Luckily the project was very much under development and so only test data was stored, but re-authoring the tabes by hand will be tedious
# Oct 11th, 17:09 devito if i wanted to overload the protected fields in the schema class and add an additional one. What would be the best way to go about it?
# Oct 11th, 15:32 slackebot1 !tias
# Oct 11th, 15:32 slackebot1 Command sent from Slack by dereuromark:
# Oct 11th, 15:32 dereuromark Didnt you try it? ;)
# Oct 11th, 15:31 dereuromark Yes
# Oct 11th, 15:14 jeremy.halin I've a weird question. When cakephp session expires and you are logged out, is the feature `redirect to previous page` is implemented and default behavior ?
# Oct 11th, 13:17 jeremy.halin I hate cache in dev environment
# Oct 11th, 13:16 jeremy.halin :,)
# Oct 11th, 13:16 slackebot1 <josbeir>
# Oct 11th, 13:16 josbeir i guess the cache does not get cleared after running migrations :P
# Oct 11th, 13:16 jeremy.halin I use cakephp migrations
# Oct 11th, 13:16 josbeir it caches the table keys
# Oct 11th, 13:16 jeremy.halin thats weird
# Oct 11th, 13:15 jeremy.halin :(
# Oct 11th, 13:15 jeremy.halin @josbeir wow thanks...
# Oct 11th, 13:15 slackebot1 <jeremy.halin>
# Oct 11th, 13:15 josbeir bin/cake cache clear_all
# Oct 11th, 13:15 josbeir did you clear the cache
# Oct 11th, 13:14 jeremy.halin @ndm @aivaras.godliauskas `beforeSave` is working but when I assign a value to my column `start_at_utc`, it's not saved to DB (column is in `accessible` array)
# Oct 11th, 13:11 scuadra @ndm thank you very much. :slightly_smiling_face:
# Oct 11th, 13:05 ndm Also it should be `Countries.name` if association is named `Countries`
# Oct 11th, 13:04 ndm Fields of associated tables need to be whitelisted: https://book.cakephp.org/3.0/en/controllers/components/pagination.html#control-which-fields-used-for-ordering
# Oct 11th, 13:02 scuadra Hello. I am using Cake 3.7. Let's say I have tables products and countries (Products belongsTo Countries). So I want to paginate my Products and be able to sort them by Country name. But when I try to use $this->Paginator->sort('Country.name') or $this->Paginator->sort('country.name') in my view the results are not sorted by Country. Where am I wrong?
# Oct 11th, 12:58 slackebot1 <jotpe>
# Oct 11th, 12:58 jotpe Thanks @ndm, this was the change i needed to do:
# Oct 11th, 12:53 jeremy.halin sorry, 37/5000 maybe I spoke too fast :slightly_smiling_face:
# Oct 11th, 12:52 jeremy.halin @aivaras.godliauskas @ndm nope, not working :(
# Oct 11th, 12:35 ndm @jeremy.halin You can, give it a try
# Oct 11th, 12:35 aivaras.godliauskas @jeremy.halin i believe only ```beforeSave``` is enough
# Oct 11th, 12:35 ndm @rchavik That's years before `cakephp/authentication` and `cakephp/authorization` even existed... maybe you were referring to something I don't see over here.
# Oct 11th, 12:34 jeremy.halin or do I need a behavior ?
# Oct 11th, 12:32 jeremy.halin @ndm thanks, can I just create a `beforeSave` function in my `table` ?
# Oct 11th, 12:31 ndm @jeremy.halin https://book.cakephp.org/3.0/en/orm/behaviors.html#defining-event-listeners https://book.cakephp.org/3.0/en/tutorials-and-examples/bookmarks/part-two.html#persisting-the-tag-string
# Oct 11th, 12:21 jeremy.halin Hi, I would like to create and save a column value based on another automatically. I have a local time in a column and want to store that same time but converted to UTC in another column. Rather than doing so in each save or update, I would like to make it automatic. I've seen https://book.cakephp.org/3.0/en/orm/table-objects.html#lifecycle-callbacks but it's unclear for me. Anyone with a concrete example please ? Thanks.
# Oct 11th, 12:14 ndm @jotpe It may help if you'd show your code... have you checked https://github.com/cakephp/authorization/issues/79 ?
# Oct 11th, 12:14 ndm That's... a totally different question ;) Look at for example https://github.com/UseMuffin/Footprint, injecting the data via events is usually the way to go.
# Oct 11th, 11:29 rochasmarcelo In your controller, ``` $user = $this->Auth->user(); ``` or ```$userId = $this->Auth->user('id');```
# Oct 11th, 11:26 jotpe How can i solve this
# Oct 11th, 11:25 jotpe I implement `Authentication\IdentityInterface` and `Authorization\IdentityInterface` on my user
# Oct 11th, 11:25 jotpe If I use Authentication with Authorization Plugin with a custom Deocrator on my User I get `Call to undefined method Authentication\Identity::setAuthorization()`
# Oct 11th, 09:59 jotpe (E.g. If I have different user groups)
# Oct 11th, 09:59 johnwayne @ndm thanx, `$getAllOpenOrders->toArray()` was the problem (it was not the array
# Oct 11th, 09:59 jotpe For the Authorization Plugin: I have several Policies and a AdminPolicy which implements BeforePolicyInterface to grant Admin Access. For now I extend all my Policies, but I wonder if there's a more advanced solution?
# Oct 11th, 09:32 ndm Are you sure that this is the query that is causing it? Also are you sure `$getAllOpenOrders` is an array (and not maybe a query)? And what is `$status`? What exactly does the generated SQL look like? That error usually happens when the table that you want to update is referenced in for example a join or a subquery.
# Oct 11th, 09:23 johnwayne Hi to all, if I try to update multiple records in the single table I am getting error... There is my Query ``` $updateAll = TableRegistry::getTableLocator()->get('Items') ->query() ->update() ->set(['status' => $status]) ->where(['order_id IN ' => $getAllOpenOrders]) ->execute(); $getAllOpenOrders = array with all relevant ids ``` The error is `You can't specify target table 'items' for
# Oct 11th, 09:23 slackebot1 update in FROM clause`
# Oct 11th, 09:07 peter im using cakephp 3
# Oct 11th, 09:06 peter Hi, how do I get the the authenticated user id when i use cakedc/users plugin
# Oct 11th, 08:17 neon1024 Morning all :wave:
# Oct 11th, 07:56 nk-sonu Issue has been solved using recursive =3
# Oct 11th, 07:36 slackebot1 'foreignKey' => 'lead_id'` ` )` ` )` ` )` `);` `$this->paginate = array(` ` 'conditions' => array('FollowupMaildeliver.user_id' => 2),` ` 'contain' => array('Lead'),` ` 'limit' => 20, ` ` 'order' => 'FollowupMaildeliver.id DESC'` `);` `$data = $this->paginate('FollowupMaildeliver');`
# Oct 11th, 07:36 nk-sonu hi, i was working on a CakePHP 2 project, its an old project. i am trying to fetch association data but "Lead" model data not coming under "FollowupEmail" model. please guide. `$this->loadModel('FollowupMaildeliver');` `$this->loadModel('FollowupEmail');` `$this->loadModel('Lead');` `$this->FollowupEmail->bindModel(` ` array('belongsTo' => array(` ` 'Lead' => array(` ` 'className' => 'Lead',` `
# Oct 11th, 07:05 jotpe Morning
# Oct 11th, 06:44 alexdd55976 morning
# Oct 11th, 05:48 spriz especially for larger stuff :)
# Oct 11th, 05:48 spriz it's tough job for PHP to do that
# Oct 11th, 05:48 spriz I do not believe one will make this too easy
# Oct 11th, 05:48 kgb.acct.personal I thought there's something like `$collection->sortBy(['field1', 'field2'])`
# Oct 11th, 05:48 spriz I see - then I would do something like that :slightly_smiling_face:
# Oct 11th, 05:48 kgb.acct.personal Nope. The collection is from request data.
# Oct 11th, 05:46 spriz no way to do this in SQL/
# Oct 11th, 05:46 spriz and do something like `return $fieldOne . '-' . $fieldTwo` but that can get messy and slow pretty quickly for lager collections :S
# Oct 11th, 05:45 spriz I guess you would need to use a function in the `->sort()`
# Oct 11th, 05:45 kgb.acct.personal @spriz Yes. Also assuming that those fields have different types