My suggestion would be to go with your initial idea. It's workable,
it'd take some fiddling with the code to make it work correctly
however. But you could achieve most of what you'd need with a bit of
code in the afterFind method of your model.


On May 31, 4:26 pm, spamec <[EMAIL PROTECTED]> wrote:
> Something is wrong with my last response.. anyway its a pitty that
> there is no real solution for this problem. I reallly thought that its
> possible without predefining fields in database in advance. Anyway
> thanks for sharing your knowledge.
>
> Dnia 31 maja 2008 3:18 "b logica" <[EMAIL PROTECTED]> napisaƂ(a):
>
>
>
> > This isn't really a CakePHP problem, then. I think you need to rethink
> > your database schema. I wouldn't suggest creating one that has table
> > columns pop into existence like that.
>
> > Add these "extra" fields/columns to the clients table with DEFAULT
> > NULL and make sure that your model validation rules have allowEmpty =
> > true. If you're unsure what other fields (besides the required ones
> > you already know about) will be wanted someday, you should probably
> > tell your client or boss to spell out their requirements for the
> > website pronto.
>
> > In any case, if, sometime in the future, they decide that they want to
> > add a "shirt size" column (for example) to the clients table it's as
> > easy as adding a new column to the table with our friend DEFAULT NULL,
> > popping the validation rule into the model, and adding the form field
> > into the views.
>
> > On Fri, May 30, 2008 at 7:05 PM, spamec  wrote:
> > > Hmm, but I dont know how many fields can admin declare. Its not
> > > possible, to make it dynamic in such a way (or am I wrong:) )..
> > > Imagine a case: admin have to extend a Client (which already has
> > > name,surname,age etc.) with additional fields like street and postal
> > > code. Of course, forms should be extended automatically.  What then?
> > > I'm interested with quite universal solution, because in future I
> > > would like to extend more of my models with such behavior..
>
> On 30 Maj, 18:31, "b logica" <[EMAIL PROTECTED]> wrote:
>
> > Why not just create an AdminPage model? Or, keep everything in Page
> > but make the other fields DEFAULT NULL in pages table?
>
> > On Fri, May 30, 2008 at 4:49 AM, spamec <[EMAIL PROTECTED]> wrote:
>
> > > Hi there,
>
> > > I came to a problem and I'm really curious how other people manage
> > > such things. I have to build an application in which, admin can extend
> > > a Page model with additional fields.
>
> > > My idea is to create:
>
> > > Tables:
> > > - dynamicfields: id, name,type, required,modelname
> > > - dynamicfields_values: id, dynamicfield_id, value,created,updated
>
> > > And know there is problem, because I have to add,edit,delete fields
> > > which are dynamic. What is more, I will have to build forms basing on
> > > dynamicfields... Do you have some experience with such situations?
>
> > > Thanks in advance!
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to