Primary key default name

16 views
Skip to first unread message

Amedi

unread,
Apr 26, 2010, 11:54:58 PM4/26/10
to Joomla! CMS Development
Hi all,

I've looked around Joomla! 1.6 Framework and have a small question: in
modeladmin.php, function save(), line 337:

$pk = (!empty($data['id'])) ? $data['id'] : (int)$this->getState($this-
>getName().'.id');

As far as I understand, the default name for primary key should be
'id', in case I use other pattern (like car_id), I should have an
extra hidden input fields that has name="id" ?

Is is worth to edit this function to:

public function save($data, $key_name = 'id')

Ame

--
You received this message because you are subscribed to the Google Groups "Joomla! CMS Development" group.
To post to this group, send an email to joomla-...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-cm...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/joomla-dev-cms?hl=en-GB.

Louis Landry

unread,
Apr 26, 2010, 11:56:27 PM4/26/10
to joomla-...@googlegroups.com
I think that probably makes a lot of sense... though it should be $keyName :)

- Louis
--
Development Coordinator
Joomla! ... because open source matters.
http://www.joomla.org
Message has been deleted

Amedi

unread,
Apr 27, 2010, 12:09:38 AM4/27/10
to Joomla! CMS Development
Yes, it should be $keyName, just forgot the Joomla Coding Standard for
a second.

(sorry for deleted wrong post, it was posted from my colleague's
computer vhv_alex)

Ame

On Apr 27, 10:56 am, Louis Landry <louis.lan...@joomla.org> wrote:
> I think that probably makes a lot of sense... though it should be $keyName
> :)
>
> - Louis
>
>
>
>
>
> On Mon, Apr 26, 2010 at 10:54 PM, Amedi <agenme...@gmail.com> wrote:
> > Hi all,
>
> > I've looked around Joomla! 1.6 Framework and have a small question: in
> > modeladmin.php, function save(), line 337:
>
> > $pk = (!empty($data['id'])) ? $data['id'] : (int)$this->getState($this-
> > >getName().'.id');
>
> > As far as I understand, the default name for primary key should be
> > 'id', in case I use other pattern (like car_id), I should have an
> > extra hidden input fields that has name="id" ?
>
> > Is is worth to edit this function to:
>
> > public function save($data, $key_name = 'id')
>
> > Ame
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Joomla! CMS Development" group.
> > To post to this group, send an email to joomla-...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > joomla-dev-cm...@googlegroups.com<joomla-dev-cms%2Bunsubscribe@go oglegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/joomla-dev-cms?hl=en-GB.
>
> --
> Development Coordinator
> Joomla! ... because open source matters.http://www.joomla.org
>
> --
> You received this message because you are subscribed to the Google Groups "Joomla! CMS Development" group.
> To post to this group, send an email to joomla-...@googlegroups.com.
> To unsubscribe from this group, send email to joomla-dev-cm...@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/joomla-dev-cms?hl=en-GB.

Reply all
Reply to author
Forward
0 new messages