Re: Automatically select a subset of a model's fields

2010-05-14 Thread Michele Ferri
Thanks. Now I gotta figure out how to limit the fields stored in
session by the Auth component, and I'm set.

On May 12, 11:46 pm, WoJoCo j...@wojoco.com wrote:
 Hi,

 In your associations you can name the fields that Cake retrieves in
 the model associations - something like:

 var $belongsTo = array(
 'User' = array(
 'className' = 'User',
 'foreignKey' = 'user_id',
 'fields' = array(
 'User.id', 'User.email', 'etc', 'etc'),
 )
 );

 Is the basic structure that will do the trick for you.

 John

 On May 12, 1:11 pm, Michele Ferri zomgs...@gmail.com wrote:



  Hi.

  In my web app I am bridging with PHPBB for user authentication, so my
  main user database table is PHPBB's user table. I created a Cake model
  for it.
  The problem is, lots of tables in my app join with the user table,
  which has a lot of fields related to PHPBB stuff, but I only really
  need the user id, name and email. Cake fetches all the fields
  everytime.
  Is there a way to specify a subset of fields to select, without having
  to add everytime a 'fields' option in the queries? I tried with the
  $_schema property but to no avail.

  Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
  with their CakePHP related questions.

  You received this message because you are subscribed to the Google Groups 
  CakePHP group.
  To post to this group, send email to cake-php@googlegroups.com
  To unsubscribe from this group, send email to
  cake-php+unsubscr...@googlegroups.com For more options, visit this group 
  athttp://groups.google.com/group/cake-php?hl=en

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group 
 athttp://groups.google.com/group/cake-php?hl=en

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.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Automatically select a subset of a model's fields

2010-05-12 Thread WoJoCo
Hi,

In your associations you can name the fields that Cake retrieves in
the model associations - something like:

var $belongsTo = array(
'User' = array(
'className' = 'User',
'foreignKey' = 'user_id',
'fields' = array(
'User.id', 'User.email', 'etc', 'etc'),
)
);

Is the basic structure that will do the trick for you.

John

On May 12, 1:11 pm, Michele Ferri zomgs...@gmail.com wrote:
 Hi.

 In my web app I am bridging with PHPBB for user authentication, so my
 main user database table is PHPBB's user table. I created a Cake model
 for it.
 The problem is, lots of tables in my app join with the user table,
 which has a lot of fields related to PHPBB stuff, but I only really
 need the user id, name and email. Cake fetches all the fields
 everytime.
 Is there a way to specify a subset of fields to select, without having
 to add everytime a 'fields' option in the queries? I tried with the
 $_schema property but to no avail.

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group 
 athttp://groups.google.com/group/cake-php?hl=en

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.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en