Unclear error

rockarena

Joined: 2007-05-03
Posts: 15
Posted: Tue, 2007-05-08 09:48

I was working on the TagsModule and created two methods in order to put a category into the database but when I click on add I get this error:

Fatal error: Cannot use object of type GalleryStatus as array in /home/projects/devgallery/site/main.php on line 231

I've checked the name of the table in Map.xml but that seems ok and I've also rebuild teh map.xml so there is nothing wrong with Map.inc.

I'm not really sure what could have caused this to happen so I'll post my code hoping that someone can help me:
TagsHelper.class:

function getCatIdFromName($catName, $caseSensitive=false){
global $gallery;

if($caseSensitive){
$whereClause = '[Categorie::catName] =?';
}
else{
$whereClause = 'UPPER([Categorie::catName]) = UPPER(?)';
}
$query ='
SELECT [Categorie::catId]
FROM
[Categorie]
WHERE'.$whereClause;
list($ret, $searchResults) = $gallery->search($query, array((string)$catName));
if($ret){
return array($ret, null);
}
if ($searchResults->resultCount() != 0) {
$result = $searchResults->nextResult();
$catId = (int)$result[0];
} else {
$catId = '';
}

return array(null, $catId);

}

function addCategory($catName){
global $gallery;
$storage=& $gallery->getStorage();
list($ret, $catId) = TagsHelper::getCatIdFromName($catName);
if($ret){
return $ret;
}
if(empty($catId)){
list($ret,$newCatId) = $storage->getUniqueId();
if($ret){
return $ret;
}
$ret = GalleryCoreApi::addMapEntry('Categorie', array('catId' => $newCatId,'catName' => $catName));
if($ret){
return $ret;
}
}

}

AdminTags.inc:

if(isset($form['action']['adder'])){
if (isset($form['CategoryAdd'])&& $form['CategoryAdd'] != ''){
$catName = $form['CategoryAdd'];
$ret = TagsHelper::addCategory(trim($catName));
if($ret){
return $ret;
}

}
$status['added'] = 1;
}
else{
$error[] = 'form[error][notagname]';
}

 
rockarena

Joined: 2007-05-03
Posts: 15
Posted: Tue, 2007-05-08 15:21

Solved

 
gioiam

Joined: 2007-07-02
Posts: 5
Posted: Fri, 2010-04-30 06:22

How did you solve this? I am having the exact same issue.