RE: overwriting loadInfo() in Model to get rid of unwanted columns

2007-03-20 Thread Mariano Iglesias

If you are using CakePHP 1.2 default values for fields will be auto
populated before saving record.

I see nothing wrong with overriding loadInfo(), that's why it's there for,
but my question is what's the scenario that there are "lots" of fields that
you will be never handling with Cake? Are you managing a table not specific
to your Cake application?

-MI

---

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 

BAKE ON!

blog: http://www.MarianoIglesias.com.ar


-Mensaje original-
De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
de RayChicago
Enviado el: Martes, 20 de Marzo de 2007 09:45 a.m.
Para: Cake PHP
Asunto: overwriting loadInfo() in Model to get rid of unwanted columns

1) is there a more elegant way ? (perhaps a way to define default
values for models where there are fields which are required to be "not
null")

2) will I run into serious problems using this approach ?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: overwriting loadInfo() in Model to get rid of unwanted columns

2007-03-20 Thread RayChicago

> If you are using CakePHP 1.2 default values for fields will be auto
> populated before saving record.
I'd very much like to use version 1.2 (behaviours, ... mhm. yummy),
although (no offense) I have had _really_ bad experiences with
"bleeding edge" branches before, so I will wait until all of the cake-
core-developer-community considers it stable enough for production
use.

 > I see nothing wrong with overriding loadInfo(), that's why it's
there for,
yay =)

> but my question is what's the scenario that there are "lots" of fields that
> you will be never handling with Cake? Are you managing a table not specific
> to your Cake application?

Yes, I have to use quite a few legacy tables, and although I could get
the information through functions via appcontroller, I'd very much
like to incorporate this information through the use of (special)
Models. I probably don't even have to manipulate this stuff at all.
just reading will suffice in the most cases.

thanks for your quick answer,
kind regards, ray


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



overwriting loadInfo() in Model to get rid of unwanted columns

2007-03-20 Thread RayChicago

Hi all !

I have a table from which I only need a subset of its actual columns.
I overwrote loadInfo() in my Model, so that it only returns the needed
subset. (I basically return a fixed array for the time being) this
works as expected in scaffolding, and it works just because none of
the fields I exclude is required to be "not null". (then I'd have to
rewrite save() too for this model).

Now my questions are :
1) is there a more elegant way ? (perhaps a way to define default
values for models where there are fields which are required to be "not
null")

2) will I run into serious problems using this approach ?

kind regards, ray


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---