fix : add getItem function to get leaflet data
This commit is contained in:
parent
bab93bf3b6
commit
ecfa92680a
@ -16,6 +16,35 @@ class LeafletModel extends ItemModel {
|
|||||||
*/
|
*/
|
||||||
protected $message;
|
protected $message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a message for display
|
||||||
|
* @param integer $pk Primary key of the "message item", currently unused
|
||||||
|
* @return object Message object
|
||||||
|
*/
|
||||||
|
public function getItem($pk= null): object {
|
||||||
|
|
||||||
|
// Utiliser la méthode getState pour obtenir l'ID de l'élément si $pk n'est pas fourni
|
||||||
|
$pk = !empty($pk) ? $pk : $this->getState($this->getName() . '.id');
|
||||||
|
|
||||||
|
// Vérifiez si l'ID est null
|
||||||
|
if ($pk === null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Charger l'élément depuis la base de données
|
||||||
|
$table = $this->getTable();
|
||||||
|
|
||||||
|
// Tenter de charger l'élément avec l'ID fourni
|
||||||
|
if (!$table->load($pk)) {
|
||||||
|
$this->setError($table->getError());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Retourne l'objet de l'élément chargé
|
||||||
|
return $table;
|
||||||
|
}
|
||||||
|
|
||||||
//------------------- ID CATEGORIES
|
//------------------- ID CATEGORIES
|
||||||
public function getCategory()
|
public function getCategory()
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user