Re: DB_DataObject_FormBuilder: linkNewValue HOWTO
| From: | Justin Patrin | Date: | Fri, 11 Mar 2005 18:53:29 +0000 |
| Subject: | Re: DB_DataObject_FormBuilder: linkNewValue HOWTO | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-17972@lists.php.net to get a copy of this message | ||
On Fri, 11 Mar 2005 19:36:49 +0100, Dot Deb <dotdeb@gmail.com> wrote:
> > Let's back up a bit here. In your original e-mail you said:
>
> > I would recommend setting it in the Paper class or as
> > $paper->fb_linkNewValue instead of $fb->linkNewValue as it could be
> > possible for the DO to overwrite that. Yeah, I know, there are 5
> > places to set options and it can be confusing.
>
> This is in fact what I tried first.
> I certainly made something wrong because I didn't work, while now it's perfect.
Ah, good.
>
> >
> > >
> > > I also tried from the ini file and it does not work; but I'm certainly
> > > missing something.
> > > Should it reads as
> > > linkNewValue=author_id:true,type_id:true ?
> >
> > Well, that should work fine, but I don't suggest doing that unless
> > you're using a different ini file for every table or your link fields
> > are the same for every table. The reason I say this is that normally
> > the same ini file is used for all of your tables, so those
> > configuration options are used for *every* table as a default. If you
> > set the option in your code ($fb->linkNewValue = ... or
> > $do->fb_linkNewValue = ...) or in your DO class, it will be
> > overwritten. But if you don't specify it, any options in the ini file
> > will be applied to all tables.
> >
>
> I completely agree with you.
:-) glad you read the docs.
>
> Anyway, I tried for curiosity with
> linkNewValue=author_id:true,language_id:true
> in the ini file, but It gives "--New Value--" for any table.
> It is probably not important, but I would like to tell you in case is
> a symptom of a bug ...
>
Actually, you're right, this is a sort of bug... But first of all, the
array should not be as you did it (I just realized this). The string
you gave would end up as:
array('author_id' => true, 'type_id' => true);
which would fail. The array should be:
array('author_id', 'type_id');
And as a string, that's:
author_id,type_id
However, due to the way that formbuilder reads in these values, this
won't work... It has to do with the default being true instead of
array(). I've changed FormBuilder.php in CVS to
1) turn off linkNewValue by default (I only turned it on by default to
"force" people to test it for me ;-) ) and
2) work for array values in the ini file.
--
Justin Patrin