AutorÃa | Ultima modificación | Ver Log |
<?phpdeclare(strict_types=1);namespace LeadersLinked\Mapper;use Laminas\Db\Adapter\AdapterInterface;use Laminas\Log\LoggerInterface;use LeadersLinked\Mapper\Common\MapperCommon;use LeadersLinked\Model\RoleRoute;class RoleRouteMapper extends MapperCommon{const _TABLE = 'tbl_role_routes';/**** @var RoleRouteMapper*/private static $_instance;/**** @param AdapterInterface $adapter*/private function __construct($adapter){parent::__construct($adapter);}/**** @param AdapterInterface $adapter* @return RoleRouteMapper*/public static function getInstance($adapter){if(self::$_instance == null) {self::$_instance = new RoleRouteMapper($adapter);}return self::$_instance;}/**** @param int $role_id* @return RoleRoute[]*/public function fetchAllByRoleId($role_id){$prototype = new RoleRoute();$select = $this->sql->select(self::_TABLE);$select->where->equalTo('role_id', $role_id);return $this->executeFetchAllObject($select, $prototype);}/**** @param array $role_ids* @return RoleRoute[]*/public function fetchAllByRoleIds($role_ids){$prototype = new RoleRoute();$select = $this->sql->select(self::_TABLE);$select->where->in('role_id', $role_ids);//echo $select->getSqlString($this->adapter->platform); exit;return $this->executeFetchAllObject($select, $prototype);}/**** @return boolean*/public function truncate(){$sql = sprintf('TRUNCATE TABLE `%s` ', self::_TABLE);return $this->executeSentenceWithParameters($sql);}}