New table in DB -> Undefined index

Hi all,

long time no post, but now I have a small problem.

I’ve created a new table in DB.
updated ojs_schema.xml

<!-- * * TABLE article_munipress * --> <table name="article_munipress"> <field name="article_id" type="I8"> <KEY /> <NOTNULL /> </field> <field name="article_number" type="C2" size="50"/> <descr>Journal article metadata (munipress).</descr> <index name="article_munipress_article_id"> <col>article_id</col> </index> </table>

Updated DAO, created get/set methods and I’m working with this data without problem (using and showing them without problems). But something still generating me the Notice error in PHP_error logs.
[11-Jan-2016 11:05:36 Europe/Paris] NOTICE: Undefined index: article_number (C:\local_servers\wamp\www\ojs\classes\article\ArticleDAO.inc.php:238)

Problem is in
function _articleFromRow(&$article, &$row) {}
on the line $article->setArticleNumber($row['article_number']);
but the index is OK. When I’ve tried use
foreach ($row as $key => $value) { echo "key = ". $key .", ".$value." <br />"; }
It shows me right key and value: key = article_number, value

I’ve cleared cache several times and upgrade system and database through CMD, but still nothing. Error is still generated.

Thank you very much for any advice.
Best Regards
Radek

Hi @Radek,

Somewhere there’s a query that’s not fetching a column named article_number. If I were debugging this, I’d add some temporary code to the _articleFromRow function to check whether the article_number index is present, and if not, throw a stack trace to see what query is being executed.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi Alec,

thank you very much. I’ve found it.

Have a nice day
Regards,
Radek