Jump to content

[RESOLU] Parse error: syntax error, unexpected $end, expecting ')


Recommended Posts

Bonjour,

 

sur une de mes pages php, j'ai une erreur de ce type :

 

Parse error: syntax error, unexpected $end, expecting ')' in /homez.34/mondomaine/www/modules/monmodule/models/Concours.php on line 1

 

Je sais ce que ça veut dire : un problème d'accolade, de parenthèse ou de ; non fermé mais impossible de le détecter.

 

Je l'ai relu 150 fois sans voir l'erreur.

 

Alors peut-être que l'un d'entre vous trouvera de son oeil averti d'où vient l'erreur dans mon code :

 

<?php

 
class Concours extends ObjectModel {
 
public $id_concours;
public $id_parent;
public $name;
public $image;
public $description;
public $date_start;
public $date_end;
public $showWinners = false;
public $active;
 
public static $definition = array(
'table' => 'concours',
'primary' => 'id_concours',
'multilang' => true,
'fields' => array(
'id_parent' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'image' => array('type' => self::TYPE_STRING),
'date_start' => array('type' => self::TYPE_DATE),
'date_end' => array('type' => self::TYPE_DATE),
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true),
'showWinners' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
 
// Lang fields
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'lang' => true),
'description' => array('type' => self::TYPE_HTML, 'validate' => 'isString', 'lang' => true)
)
);
 
public function __construct($id = null, $id_lang = null)
{
parent::__construct($id, $id_lang);
 
$this->image_dir = _PS_IMG_DIR_.'ModuleConcoursCreation/img_concours/';
}
 
public static function findAll($id_lang, $only_parents = false, $active = false) {
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT DISTINCT c.*, cl.*
FROM `'._DB_PREFIX_.'concours` c
JOIN `'._DB_PREFIX_.'concours_lang` AS cl ON (c.`id_concours` = cl.`id_concours` AND cl.`id_lang` = '.(int)$id_lang.')'
.($only_parents ? ' AND c.id_parent = 0 ' : '')
.($active ? ' AND c.active = 1 ' : '')
.' ORDER BY c.`id_concours` ASC');
}
 
public function findChildrens($id_lang, $active =  false) {
if(!empty($this->id_concours)){
$sql = 'SELECT DISTINCT c.*, cl.* 
FROM `'._DB_PREFIX_.'concours` c
JOIN `'._DB_PREFIX_.'concours_lang` AS cl ON (c.`id_concours` = cl.`id_concours` AND cl.`id_lang` = '.$id_lang.')'
.' AND c.id_parent = '.$this->id_concours 
.($active ? ' AND c.active = 1 ' : '').
' ORDER BY cl.`name`';
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
}
return array();
}
 
 
public function IsInInterval() {
$row = Db::getInstance()->getValue('
SELECT COUNT(*)
FROM `' . _DB_PREFIX_ . 'concours`
WHERE id_concours = ' . $this->id_concours . ' AND NOW() BETWEEN date_start AND date_end'
);
if($row == 0)
return false;
else
return true;
}
 
public function InscriptionEnd() {
$row = Db::getInstance()->getValue('
SELECT COUNT(*)
FROM `' . _DB_PREFIX_ . 'concours`
WHERE id_concours = ' . $this->id_concours . ' AND NOW() > date_end'
);
if($row == 0)
return false;
else
return true;
}
 
}
?>
 
Je vous serez très reconnaissance de votre aide, je suis totalement désespérée de pas trouver la solution :)
 
Merci d'avance,
 
Pauline
Edited by pauline75 (see edit history)
Link to comment
Share on other sites

Bonjour,

je n'y connais absolument rie  en code (:) ) mais dans ces lignes :

public static $definition = array(
'table' => 'concours',
'primary' => 'id_concours',
'multilang' => true,
'fields' => array(
 
la parenthèse du array( ne devrait-elle pas être fermée quelque part ?
Link to comment
Share on other sites

  • 9 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...