id; } public function getIds() { return json_decode($this->ids, true); } public function setIds($ids) { $this->ids = json_encode($ids); } public function getCount() { return $this->count; } public function setCount($count) { $this->count = $count; } public function getType() { return $this->type; } public function setType($type) { $this->type = $type; } public function getUser() { return $this->user; } public function setUser($user) { $this->user = $user; } /* * other methods * */ /** * Ajoute l'identifiant a la liste d'identifiant * * @param int $id */ public function addId($id) { $ids = $this->getIds(); if (!count($ids)) { $ids = array(); } if (!$this->hasId($id)) { $ids[] = (string)$id; $this->setCount(count($ids)); } $this->setIds($ids); } /** * Répond vrai si l'id transmis fait partis des ids * * @param int $id_check * @return boolean */ public function hasId($id_check) { if (count($ids = $this->getIds())) { foreach ($ids as $id) { if ($id == $id_check) { return true; } } } return false; } }