Logs for #cakephp

Page 1 of 34,423, showing 100 records out of 3,442,226 total, starting on record 1, ending on 100

# At Username Text
# Today, 21:03 bigdaddygee I get this SQL (I've replaced all field name by *...) SELECT * FROM alerts Alerts INNER JOIN users Users ON Users.id = (Alerts.user_id) WHERE (Users.digestType = :c0 AND AlertCategories.sub_category_id in (:c1,:c2,:c3))
# Today, 21:02 bigdaddygee Hum, i'm facing a problem and I understand why it happen, but can't figure how to fix it right now... I'm using contain to require some tables that are related to my queried one and I want to filter theses results where they meet some predefined id. I expected an inner join from the query builder to occur, but instead it create other sql request so I can't filter into it's telling me unknown column name :|
# Today, 20:45 GutaFish is possible to get from tash which shell command called it ? Or. How I could disable welcome message from task?
# Today, 20:39 bigdaddygee they are handled by Cake itself
# Today, 20:39 bigdaddygee You should not take care of modified or created
# Today, 19:57 siran ... maybe .... though I doubt it, since I was doing an unset($row['modified']) before the save()
# Today, 19:56 siran that can solve the issue
# Today, 19:56 siran maybe I could put 'modified' in the accesible fields...
# Today, 19:54 siran slackebot: part of the problem was with my $row, but still I'd like to prevent cake from doing an update where the only field changing is the modifies field
# Today, 19:32 bigdaddygee and compare it with what you have on $row
# Today, 19:32 bigdaddygee create an array from your get on line 8
# Today, 19:27 siran slackebot: it might be something on the data... need some time to check
# Today, 19:26 siran slackebot: also I don't know what two arrays you want to 'diff'
# Today, 19:26 siran slackebot: I unset'ed modifiedandcreated fields that came in $row... but stilll
# Today, 19:23 bigdaddygee Let's check it with
# Today, 19:23 bigdaddygee http://php.net/manual/en/function.array-diff-assoc.php
# Today, 19:21 bigdaddygee at line 8 you'll have to check if $row is different from what you receive in $entity
# Today, 19:20 siran slackebot: i updated it removing all non-important lines
# Today, 19:18 bigdaddygee let me check
# Today, 19:18 bigdaddygee np
# Today, 19:18 siran unfortunately I didn't know how to put php format
# Today, 19:18 siran https://gist.github.com/siran/feb1fb0d0c98d8211e35f6438c6fefe6
# Today, 19:17 siran i was there
# Today, 19:17 siran np
# Today, 19:16 bigdaddygee you do need a github account, if you don't paste it to pastebin.org but it's more clean on gist.
# Today, 19:15 bigdaddygee siran https://gist.github.com/
# Today, 19:15 bigdaddygee @admad I found ! :) I use newExpr()->add()
# Today, 19:15 siran slackebot: where do i make the gist?
# Today, 19:13 bigdaddygee Can you past the code on gist ?
# Today, 19:10 siran slackebot: so apparently the $data i'm saving is the same as the record, so the only thing changin is the 'modified' field
# Today, 19:09 siran slackebot: i do a find to see if the record exists, if it exists I patchEntity() with an array of values (that may or may not be the same as the one already in the table); if it doesn't exist I do a newEntity()
# Today, 19:09 siran i do a find to see if the record exists, if it exists I patchEntity() with an array of values (that may or may not be the same as the one already in the table); if it doesn't exist I do a newEntity()
# Today, 19:08 bigdaddygee I mean, in your code, do you know where this update is fired ?
# Today, 19:07 siran slackebot: I get: UPDATE mytable SET modified = '2017-01-22 18:57:35' WHERE id = '58062825'
# Today, 19:07 bigdaddygee Oh, and what's your save procedure right now ? (gist)
# Today, 19:06 siran slackebot: apparently im invoking save() on an entity without changes... so when I look the generated SQL (using debugkit) it is only updating the table's modified field
# Today, 19:05 bigdaddygee siran, can you explain a little bit more ?
# Today, 19:05 siran how can I avoid doing **updates where the only thing changing is the 'modified' field ?
# Today, 19:04 siran how can I avoid doing updated where the only thing changing is the 'modified' field ?
# Today, 19:03 siran hi y'all !
# Today, 18:56 bigdaddygee admad I trying to use concat right now I just found it, is it worth to try this way ?
# Today, 18:55 admad @bigdaddygee https://book.cakephp.org/3.0/en/orm/query-builder.html#using-sql-functions
# Today, 18:54 bigdaddygee I also tried $query = $this->Ads->find('all'); $query->where(['created >=' => $query->func()->now() .' - INTERVAL 1 HOUR'])->toArray(); but since i'm trying to concatenate a function and a string I receive an error... :|
# Today, 18:51 bigdaddygee Hi everybody, I'm trying to use MySQL function and constant in CakePHP ORM and i'm not exactly sure how to do it... Target SQL : SELECT * FROM ads WHERE created >= (NOW() - INTERVAL 1 hour) Actualy in CakePHP : $this->Ads->find('all')->where(['created >=' => Time::now() .' - INTERVAL 1 HOUR'])->toArray();
# Today, 17:55 hytromo Thanks guys, this `$visitHours = $this->ProfessorVisitHours->find()->where(['professor_id' => $id])->groupBy(function($prof){ return $prof->day; })->toArray();` worked
# Today, 17:49 thinkingmedia that stuff is a pain. When it doesn't work it's just an empty result.
# Today, 17:48 hmic good call!
# Today, 17:48 hmic ;-)
# Today, 17:48 thinkingmedia I would just debug what `groupBy` is getting. ``` $this->ProfessorVisitHours->find()->where(['professor_id' => $id])->groupBy(function($prof){ dd($prof); }); ```
# Today, 17:48 hmic sure, you need to supply the right path to group by to the collection, so check the data returned first and add the correct path to the groupBy, like thinkingmedia suggests
# Today, 17:47 thinkingmedia the groupBy will execute the query
# Today, 17:47 hmic like: find()->where()->all()->groupBy()
# Today, 17:46 hmic hytromo: maybe you need to execute the query first, then apply the collection function
# Today, 17:46 thinkingmedia try including the alias `->groupBy('ProfessorVisitorHours.day')`
# Today, 17:45 hytromo thinkingmedia, I know, I am talking about Collection's groupBy, not query's group ( https://book.cakephp.org/3.0/en/orm/query-builder.html#aggregates-group-and-having> VS <https://book.cakephp.org/3.0/en/core-libraries/collections.html#grouping-and-counting )
# Today, 17:44 thinkingmedia Group by SQL is not the same thing as group the results.
# Today, 17:44 hytromo I also tried converting toArray() first and then passing it to a normal Collection object, and still it didn't work. Ideas?
# Today, 17:43 hytromo I fetch some rows from the db and I want to group the results by the field 'day' (int from 0 to 6 for day of week)). `$this->ProfessorVisitHours->find()->where(['professor_id' => $id])->groupBy('day')` doesn't work at all.
# Today, 17:33 al_x_mq i made it work. thanks
# Today, 17:33 hmic "If a Table contains a foreign key, it belongs to the other Table."
# Today, 17:33 hmic al_x_mq: from the book: https://book.cakephp.org/3.0/en/orm/associations.html#belongsto-associations
# Today, 17:15 al_x_mq is this belongsTo or hasOne?
# Today, 17:15 al_x_mq in schedules fields home and guest
# Today, 17:14 al_x_mq table schedules
# Today, 17:14 al_x_mq table of teams
# Today, 17:14 al_x_mq want to build a game schedule
# Today, 17:14 al_x_mq example.
# Today, 17:14 al_x_mq how can i connect 2 tables, over a field, that is not fitting the convention?
# Today, 16:18 slackebot Action: admad hands hmic some calming down juice
# Today, 16:16 hmic throws his hands up *shudders*
# Today, 16:14 hmic and please upgrade to a recent 2.x release, *now*
# Today, 16:14 admad *your
# Today, 16:13 admad just update you js code accordingly and you won't have to much around with the controller code
# Today, 16:13 hmic like admad said. you don't pass anything to login(), if you want the login data beeing checked, make sure your post data is correct rather, as that is what the login checks on a form auth
# Today, 16:13 admad set `$this->request->data['User']['email']` and similarly password and call ->login() without params
# Today, 16:12 hmic https://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#identifying-users-and-logging-them-in, scroll down to the red box and read carefully
# Today, 16:12 hmic but there is no excuse to sticking with a totally outdaed 2.x!
# Today, 16:11 hmic not upgrading to 3.x might be a thing
# Today, 16:11 hmic oh man
# Today, 16:11 execv 2.3.3
# Today, 16:10 execv I have the same result if I don’t pass anything to Auth->login()
# Today, 16:10 admad what version of cake are you using?
# Today, 16:10 admad if you do that the params will be just set to session, no db check will be done
# Today, 16:09 admad don't pass anything to login
# Today, 16:09 execv Nevermind. Auth->user() isn’t empty, but it’s the array I am passing to login
# Today, 16:08 execv Auth Setup: http://pastebin.com/55xgXNkX
# Today, 16:08 execv I’m not starting a new app. I’m just adding an ajax login to an existing one. The current login() function is working perfectly
# Today, 16:07 hmic additionally, why do you start out a new app on 2.x still?
# Today, 16:07 hmic you do actually very likely need to show your auth setup
# Today, 16:07 execv It’s empty
# Today, 16:07 hmic execv, try debuggin Auth->user() instead, whats in?
# Today, 15:59 execv Any help as to why this isn’t working? http://pastebin.com/fSvUiZ2W I am trying to log a user in using AJAX. Regardless of what I send as the username and password, this->Auth->login() always returns true, but never with a UID.
# Today, 15:46 hmic just use the proper function for the task: array_key_exists
# Today, 15:45 thinkingmedia Just got hit by the `isset($arra[$key])` return false for null values. It's moments like this I hate PHP.
# Today, 15:02 temp1029 @admad Doh, sorry, typing fast while trying to make breakfast
# Today, 14:45 admad @temp1029 try to get my nick correct next time :slightly_smiling_face:
# Today, 14:33 temp1029 thanks for your input too ahmad, :)
# Today, 14:19 temp1029 thanks hmic, thats what I was thinking too
# Today, 14:15 hmic temp1029: as auth usually gets configured in the appcontroller and you do have different requirements for the both sections, that sounds like different appcontrollers for both sections to me. i certainly did so :p
# Today, 14:12 temp1029 i'm creating an admin section, which has an auth piece to it, and then a public facing section, which has no need for auth, does it make sense to use multiple appcontrollers in this case? my first thought it yes, but i am just using one now and I'm not seeing any issues, although i've barely built out the public facing piece