Re: Question about relationships, extending the blog tutorial

2010-02-25 Thread Andy Dirnberger
Glad to hear you were able to get that resolved. Check out the documentation for the Auth component http://book.cakephp.org/view/172/Authentication, in particular the user method http://book.cakephp.org/view/387/user. On Feb 24, 3:04 pm, deek derek.bon...@gmail.com wrote: Andy, It looks like

Re: Question about relationships, extending the blog tutorial

2010-02-24 Thread WebbedIT
Can you show us the structure of your table? It seems Cake is not able to find that field. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group.

Re: Question about relationships, extending the blog tutorial

2010-02-24 Thread Andy Dirnberger
If you have debug set to 0 in core.php and added displayname to the user table after Cake first saw the it, you need to update the cache of the table's layout. (Either set debug to 1, reload the page, and set it back to 0 or delete the file in tmp.) On Feb 24, 2:36 am, deek derek.bon...@gmail.com

Re: Question about relationships, extending the blog tutorial

2010-02-24 Thread deek
Andy, It looks like the debug issue was the problem and everything is now working properly. My final question is this. Once a user is logged on (through the built-in Auth of CakePHP), what built-in functions should I use to determine that user's id number? For that matter what is a good way to

Re: Question about relationships, extending the blog tutorial

2010-02-23 Thread WebbedIT
^^ What @Andy says is right. Simple rule of thumb for hasMany/hasOne - belongsTo relationships ... whichever model your foreign_key is in, it belongs to the other model. Welcome to CakePHP, it should make learning complex PHP a lot easier for you. I sometimes wish I hadn't taught myself a lot

Re: Question about relationships, extending the blog tutorial

2010-02-23 Thread deek
So I updated my post model to what you see below and now when I go to my index (index.ctp) view that I have listed on my first post nothing shows up. Do I need to add anything in the controllers or the user model? Once get it to show properly how would I call the the User displayname in my

Re: Question about relationships, extending the blog tutorial

2010-02-23 Thread Andy Dirnberger
Did you try just using var $belongsTo = array('User');? The values you are supplying for className and foreignKey should be the defaults. If you remove the $belongsTo piece, do your posts show up again? If not, what else did you change? What code do you currently have in your controller? No

Re: Question about relationships, extending the blog tutorial

2010-02-23 Thread deek
Well everything seems to be working now with var $belongsTo = array('User'); but I have tried putting ?php echo $post['User'] ['displayname']; ? in my index.ctp and the it does not output any of the information. If I put ?php echo $post['User']['id']; ? or ?php echo $post['User']['username']; ?

Re: Question about relationships, extending the blog tutorial

2010-02-23 Thread deek
Also when I try and add a user with this form h1Add User/h1 ?php echo $form-create('User', array('action' = 'register')); echo $form-input('username'); echo $form-input('displayname'); echo $form-input('password'); echo $form-end('Add User'); ? the displayname never makes it

Question about relationships, extending the blog tutorial

2010-02-22 Thread deek
First of all let me say I'm very new to CakePHP and complex PHP in general. I based the blog I am working on off the tutorial on the CakePHP website. I skipped creating ACL or a more complex management of permissions because as of now the only people who will be posting content will be Authorized

Re: Question about relationships, extending the blog tutorial

2010-02-22 Thread Andy Dirnberger
Try $belongsTo instead of $hasOne. $belongsTo = array('User'); On Feb 22, 7:03 pm, deek derek.bon...@gmail.com wrote: First of all let me say I'm very new to CakePHP and complex PHP in general.  I based the blog I am working on off the tutorial on the CakePHP website. I skipped creating ACL

Re: Question about relationships

2009-07-07 Thread Robert P
Official documentation to the rescue: http://book.cakephp.org/ contains the answers to *most* of the questions you will have regarding Cake. For this specific question try http://book.cakephp.org/view/84/Saving-Related-Model-Data-hasOne-hasMany-belongsTo

Question about relationships

2009-07-06 Thread Alastair
Hi guys, Hopefully a fairly straight forward question. I have the following two models: Member, User. User hasOne Member, Member belongsTo User. In my application, I have a Members admin area, which lists all the Members. I need to allow the admin to create a corresponding User for a Member and