unique ID's and where they come from?

OJS development discussion, enhancement requests, third-party patches and plug-ins.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.
Posts: 31
Joined: Fri Jul 11, 2008 10:57 am

unique ID's and where they come from?

Postby mark » Mon Sep 08, 2008 3:54 pm

I've been studying OJS 2.1. code and am trying to figure out how Model Classes get their unique ID's. For example, Article::setArticleId is given an id and sets the parent Data Object accordingly. However, where is the unique articleID that is given to Article::setArticleID created and what mechanism ensures that it is unique (I'd assume that assurance that its unique can only come from DB layer rather than application layer?


Posts: 952
Joined: Mon May 05, 2008 10:29 am
Location: Vancouver, BC

Re: unique ID's and where they come from?

Postby mcrider » Wed Sep 10, 2008 4:38 pm

Hi Mark,

You are correct in assuming that this mechanism is done at the database level--The article ID is the primary key for the articles table and is auto-incremented after every insert. The setArticleId function is used to assign the article id to a PHP article object, and it gets its parameter from the database.

Hope that clears things up a bit,

Return to “OJS Development”

Who is online

Users browsing this forum: No registered users and 1 guest