mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-20 16:37:48 +02:00
Add phone
This commit is contained in:
parent
5aec083831
commit
b1c4a1e3aa
5 changed files with 489 additions and 50 deletions
|
@ -16,6 +16,18 @@ namespace models;
|
|||
*/
|
||||
class Phone extends \descartes\Model
|
||||
{
|
||||
/**
|
||||
* Return list of phones.
|
||||
* @param int $id_user : User id
|
||||
* @param int $limit : Number of user to return
|
||||
* @param int $offset : Number of user to skip
|
||||
*/
|
||||
public function list($id_user, $limit, $offset)
|
||||
{
|
||||
return $this->_select('phone', ['id_user' => $id_user], null, false, $limit, $offset);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a phone by his id
|
||||
* @param int $id : Phone id
|
||||
|
@ -25,6 +37,28 @@ namespace models;
|
|||
{
|
||||
return $this->_select_one('phone', ['id' => $id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a phone by his number
|
||||
* @param string $number : phone number
|
||||
* @return array
|
||||
*/
|
||||
public function get_by_number (string $number)
|
||||
{
|
||||
return $this->_select_one('phone', ['number' => $number]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a phone by his number and user
|
||||
* @param string $number : phone number
|
||||
* @param int $id_user : user id
|
||||
* @return array
|
||||
*/
|
||||
public function get_by_number_and_user (string $number, int $id_user)
|
||||
{
|
||||
return $this->_select_one('phone', ['number' => $number, 'id_user' => $id_user]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Find phones of a user
|
||||
|
@ -61,8 +95,8 @@ namespace models;
|
|||
* Create a phone
|
||||
* @param int $id_user : User to insert phone for
|
||||
* @param string $number : The number of the phone
|
||||
* @param string $platform : The platform to use the phone
|
||||
* @param string JSON $platform_datas : A json string representing the datas of the platform (for exemple credentials of an api)
|
||||
* @param string $adapter : The adapter to use the phone
|
||||
* @param string JSON $adapter_datas : A json string representing the datas of the adapter (for exemple credentials of an api)
|
||||
* @return mixed bool : false on error, true on success
|
||||
*/
|
||||
public function insert($phone)
|
||||
|
@ -76,8 +110,8 @@ namespace models;
|
|||
* @param int $id : Id of the phone
|
||||
* @param int $id_user : User to insert phone for
|
||||
* @param string $number : The number of the phone
|
||||
* @param string $platform : The platform to use the phone
|
||||
* @param string JSON $platform_datas : A json string representing the datas of the platform (for exemple credentials of an api)
|
||||
* @param string $adapter : The adapter to use the phone
|
||||
* @param string JSON $adapter_datas : A json string representing the datas of the adapter (for exemple credentials of an api)
|
||||
* @return mixed bool : false on error, true on success
|
||||
*/
|
||||
public function update ($id, $phone)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue