AutorÃa | Ultima modificación | Ver Log |
<?php
declare(strict_types=1);
namespace LeadersLinked\Mapper;
use LeadersLinked\Mapper\Common\MapperCommon;
use Laminas\Db\Adapter\AdapterInterface;
use LeadersLinked\Model\PositionSubordinate;
class PositionSubordinateMapper extends MapperCommon
{
const _TABLE = 'tbl_position_subordinates';
/**
*
* @var PositionSubordinateMapper
*/
private static $_instance;
/**
*
* @param AdapterInterface $adapter
*/
private function __construct($adapter)
{
parent::__construct($adapter);
}
/**
*
* @param AdapterInterface $adapter
* @return PositionSubordinateMapper
*/
public static function getInstance($adapter)
{
if(self::$_instance == null) {
self::$_instance = new PositionSubordinateMapper($adapter);
}
return self::$_instance;
}
/**
*
* @param int $id
* @return PositionSubordinate
*/
public function fetchOne($id)
{
$select = $this->sql->select(self::_TABLE);
$select->where->equalTo('id', $id);
$prototype = new PositionSubordinate();
return $this->executeFetchOneObject($select, $prototype);
}
/**
*
* @param string $uuid
* @return PositionSubordinate
*/
public function fetchOneByUuid($uuid)
{
$select = $this->sql->select(self::_TABLE);
$select->where->equalTo('uuid', $uuid);
$prototype = new PositionSubordinate();
return $this->executeFetchOneObject($select, $prototype);
}
/**
*
* @return PositionSubordinate[]
*/
public function fetchAllByPositionId($position_id)
{
$select = $this->sql->select(self::_TABLE);
$prototype = new PositionSubordinate();
return $this->executeFetchAllObject($select, $prototype);
}
}