Log message #4020084

# At Username Text
# Apr 25th 2017, 20:46 jeremyharris see here: https://book.cakephp.org/2.0/en/models/associations-linking-models-together.html#hasone
# Apr 25th 2017, 20:46 losted ok
# Apr 25th 2017, 20:46 jeremyharris okay remember that bindModel is a one time only thing. I suggest using permanent associations in your models instead, and using contain
# Apr 25th 2017, 20:46 losted for the UserProfile, do I enter my stuff in there of I need another bindModel like : $this->Credit->User->bindModel(...) ?
# Apr 25th 2017, 20:45 losted https://pastebin.com/raw/xKgN1Y4r
# Apr 25th 2017, 20:45 losted here's where I'm at right now
# Apr 25th 2017, 20:45 jeremyharris if I’m understanding right: User hasOne UserProfile and User hasMany Credit and Credit belongsTo User and UserProfile belongsTo User
# Apr 25th 2017, 20:44 jeremyharris so in this case, your user profile association would be included in the original User hasOne relationship
# Apr 25th 2017, 20:43 jeremyharris losted generally you set up all of the relationships (e.g., define your belongsTo array that contains ALL associations) and use contain to select what data to include in the find()
# Apr 25th 2017, 20:41 jeremyharris I tried your method and work well with my initial Models but I still don't get how to make my UserProfile relationship
# Apr 25th 2017, 20:37 jeremyharris :+1:
# Apr 25th 2017, 20:37 dan223 Ahh. That is what I am looking for. Thank you
# Apr 25th 2017, 20:33 jeremyharris dan223 perhaps matching is what you’re after? https://book.cakephp.org/3.0/en/orm/retrieving-data-and-resultsets.html#filtering-by-associated-data-via-matching-and-joins
# Apr 25th 2017, 20:33 losted (yes it's cake 2)
# Apr 25th 2017, 20:33 losted Ok thanks I'll have a look at it
# Apr 25th 2017, 20:32 jeremyharris (I’m guessing it’s cake 2 from the looks of it)
# Apr 25th 2017, 20:32 jeremyharris also, you can add all associations and just retrieve them with contain
# Apr 25th 2017, 20:32 jeremyharris losted that’s probably not the best way to do it, instead look at this: https://book.cakephp.org/2.0/en/models/associations-linking-models-together.html#creating-and-destroying-associations-on-the-fly
# Apr 25th 2017, 20:30 dan223 I havea a simple application that manages instructors, courses and students. I am trying to rerieve courses an instructor can teach, but am running into a problem. I’ve pasted my find() function here: https://pastebin.com/BT6qLHch - any thoughts? I want to only include courses where there is an entry in InstructorCourses for that instructor and course id. Should I update my find() to retrieve data from InstructorCourses instead of Courses?
# Apr 25th 2017, 20:29 losted Hello everyone I have a relationship problem (with CakePHP). My users have credits (think $$) and a user profile (info like their country). I load the credits relationship in ad-hoc mode because I don't always want them and it look like this and it works wonderfully so far : https://pastebin.com/raw/P5XZEq2Y ... What I need now is to add the relationship User -> UserProfile and I can't seem to find how. Any help is appreciated tha
# Apr 25th 2017, 19:58 doug__ cool thanks
# Apr 25th 2017, 19:56 jeremyharris so a bit of code and your own loop
# Apr 25th 2017, 19:56 jeremyharris https://api.cakephp.org/3.4/source-class-Cake.View.Helper.PaginatorHelper.html#954
# Apr 25th 2017, 19:56 jeremyharris perhaps you can generate them manually via generateUrl (which is what the numbers method uses)
# Apr 25th 2017, 19:54 doug__ I tried that but it appends all the urls together...
# Apr 25th 2017, 19:53 jeremyharris doug__ you could change the templates to return just {{url}}
# Apr 25th 2017, 19:53 doug__ I need the ->numbers() in json format in the end...
# Apr 25th 2017, 19:52 doug__ What is the best way to get an array of urls instead of a string using $this->Paginator->numbers()?
# Apr 25th 2017, 19:22 doug__ thaks admad
# Apr 25th 2017, 19:17 jeremyharris and they have separate domains?
# Apr 25th 2017, 19:17 jeremyharris I thought it was a completely separate app, perhaps you can tell me exactly how it is set up. e.g., 2 separate cakephp apps, 1 DB
# Apr 25th 2017, 19:14 spylinux Yes, user login with other table, but i have in AppController on initialize() method, a loadComponent Auth, that redirect me to 1st login screen
# Apr 25th 2017, 19:13 jeremyharris by auth you mean user login? that’s okay, just configure the auth component to use the members table instead (on the second app)
# Apr 25th 2017, 19:12 spylinux @jeremyharris but i can't use the same auth from the 1st application, the 2nd have your member table to use for login
# Apr 25th 2017, 19:08 jeremyharris if the 2nd app is read only, you can connect to the DB with a user that only has SELECT permissions
# Apr 25th 2017, 19:07 spylinux but the 2nd app have full data tables, with other login pattern, other layout, other users, needs authenticate again
# Apr 25th 2017, 19:06 spylinux the 1st app, input some data, and create on the fly, some tables of csv and txt import. The 2nd app, "read" and filter this data
# Apr 25th 2017, 19:05 jeremyharris if they are just sharing the same DB then there is probably no need to share any code at all (or globally install anything). just have both of them connect to the DB
# Apr 25th 2017, 19:05 spylinux sharing only the database, only a few tables btw
# Apr 25th 2017, 19:05 jeremyharris if the apps are sharing some logic, perhaps a plugin would be best?
# Apr 25th 2017, 19:04 jeremyharris no need to apologize!