# |
Oct 3rd 2018, 17:13 |
matsaku |
No sorry |
# |
Oct 3rd 2018, 17:13 |
btx |
o sorry I thought they were same table |
# |
Oct 3rd 2018, 17:12 |
matsaku |
You mean making the same table as Todos for SharedTodos. And when I want to share, I just duplicate the Todo in the other table ? |
# |
Oct 3rd 2018, 17:10 |
matsaku |
Oh |
# |
Oct 3rd 2018, 17:10 |
btx |
then you’d have `$user->todos` and `$user->shared_todos` |
# |
Oct 3rd 2018, 17:09 |
btx |
@matsaku i would have Todos and SharedTodos associations where SharedTodos is a Todos, but with a conditional filter then just `Users->contain['Todos','SharedTodos'])->..` |
# |
Oct 3rd 2018, 17:08 |
slackebot |
->order(['done' => 'ASC', 'created' => 'DESC']); $todos = $query->toArray(); ``` I really don't know where to look anymore :( |
# |
Oct 3rd 2018, 17:08 |
matsaku |
I'm trying this but doesn't works also : ``` $todos = TableRegistry::get('Todos'); $query = $todos->find('all') ->join([ 'table' => 'todo_shared', 'alias' => 'ts', 'type' => 'LEFT', 'conditions' => 'ts.todo_id = Todos.id' ]) ->where(['OR' => [['Todos.user_id =' => $this->Auth->user('id')], ['ts.user_id = ' => $this->Auth->user('id')]]]) |
# |
Oct 3rd 2018, 16:40 |
slackebot |
which join I should use. The point is to get all the tasks the user created and the others tasks users shared with him |
# |
Oct 3rd 2018, 16:40 |
matsaku |
An other question for my case, I need to do this request with the query builder : `SELECT * FROM todos LEFT JOIN todo_shared AS ts ON ts.user_id = $userId WHERE ts.todo_id = todos.id OR todos.id = $userId;` My actual query look like this : ``` $query = $todos->find('all') ->where(['Todos.user_id =' => $this->Auth->user('id')]) ->order(['done' => 'ASC', 'created' => 'DESC']); ``` I'm not even sure |
# |
Oct 3rd 2018, 16:36 |
narendravaghela |
SendGrid provides SMTP credentials as well which you can set in email config. |
# |
Oct 3rd 2018, 16:36 |
narendravaghela |
Agree with @admad |
# |
Oct 3rd 2018, 16:36 |
admad |
@neon1024 if you don't need the extra features their api provides then can just user their smtp login |
# |
Oct 3rd 2018, 16:34 |
narendravaghela |
I generally need emails in backend apps, so I convert it into plugins for community use |
# |
Oct 3rd 2018, 16:34 |
narendravaghela |
@neon1024 yes, and few others for emails :slightly_smiling_face: |
# |
Oct 3rd 2018, 16:15 |
matsaku |
(but with !empty in my case) |
# |
Oct 3rd 2018, 16:15 |
matsaku |
@btx thanks it works smoothly ! |
# |
Oct 3rd 2018, 16:11 |
btx |
@matsaku try `if( empty($user) )` |
# |
Oct 3rd 2018, 16:10 |
traneXH |
yaman mo hayop |
# |
Oct 3rd 2018, 16:09 |
traneXH |
gib it to hir |
# |
Oct 3rd 2018, 16:07 |
matsaku |
But you there are other proper solution I'm all ears |
# |
Oct 3rd 2018, 16:07 |
matsaku |
Ok I got it with a $user != null |
# |
Oct 3rd 2018, 15:58 |
slackebot |
the user exist. If not it throw me an error trying is_empty on null. Sorry for this simple question I feel like I'm not that far ._. |
# |
Oct 3rd 2018, 15:58 |
matsaku |
Hi there, I want to check if the user exist in the database and extract his id in a controller. How do I verify if the user exist and then get his id ? ```PHP $user = $userTable->find() ->select(['id']) ->where(['Users.email =' => $this->request->getData('user')]) ->first(); if (!$user->isEmpty()) { ``` This is the code to get user info. It works only when |
# |
Oct 3rd 2018, 15:56 |
neon1024 |
Yes, seems you’ve done this @narendravaghela :thumbsup: I shall follow your plugins technique |
# |
Oct 3rd 2018, 15:55 |
neon1024 |
Such as creating a custom mail transport |
# |
Oct 3rd 2018, 15:54 |
neon1024 |
Is there a neater way for me to integrate SendGrid, than just calling it’s call instead of Cake\Network\Email |
# |
Oct 3rd 2018, 15:38 |
btx |
@ricksaccous np, fwiw |
# |
Oct 3rd 2018, 15:30 |
neon1024 |
Great thanks, feel free to open ticket for any issues you find :slightly_smiling_face: |
# |
Oct 3rd 2018, 15:29 |
sdevore |
You I have been thinking of using it as I work on adding sparkpost api support…. Since it is early in the process I’ll check out the 2.0/develop branch if you want |
# |
Oct 3rd 2018, 15:04 |
ricksaccous |
@btx thanks for the suggestion |
# |
Oct 3rd 2018, 15:00 |
admad |
nice.. IRC spam get's gobbled up |
# |
Oct 3rd 2018, 15:00 |
btx |
haha sometimes these bot messages seem to fit the conversation |
# |
Oct 3rd 2018, 14:59 |
polly |
either works though |
# |
Oct 3rd 2018, 14:59 |
polly |
who wrote this? |
# |
Oct 3rd 2018, 14:59 |
btx |
yeah basically same ok |
# |
Oct 3rd 2018, 14:57 |
ricksaccous |
i'm not precise about the set up i haven't been here long but it seems to be dev -> review site (QA) -> beta (not sure what this translates to) -> production |
# |
Oct 3rd 2018, 14:56 |
btx |
do you guys have DEV (local) -> Integration -> User Testing -> PROD setup? |
# |
Oct 3rd 2018, 14:56 |
btx |
or do an “INITIAL ENTRY” record and set it to that - either way you’re gonna futz with other dev’s projects (which should only matter when you migrate to your Integration Testing platform) |
# |
Oct 3rd 2018, 14:55 |
slackebot |
anything up with that FK |
# |
Oct 3rd 2018, 14:55 |
btx |
i would definitely avoid truncating tables, that’d be data you’d then have to recreate. and technically if you could recreate it programmatically then you could also have figured out the FK programmatically in the first place. If there are multiple options and it’s not possible to determine the right one AND it’s important to know the right one, then you could do a “MIGRATIONS-20181003” record in the related table and then go back and |