PHP Classes

File: src/MySQLReplication/Event/DTO/RotateDTO.php

Recommend this page to a friend!
  Classes of Kacper Rowinski   PHP MySQL Replication   src/MySQLReplication/Event/DTO/RotateDTO.php   Download  
File: src/MySQLReplication/Event/DTO/RotateDTO.php
Role: Configuration script
Content type: text/plain
Description: Configuration script
Class: PHP MySQL Replication
Client to get MySQL replication events in pure PHP
Author: By
Last change: Feature/php71 (#53)

- Removed: support for lesser then php7
- Added: strong and string types
- Changed: ConfigFactory removed and method make form array moved to Config
- Changed: MariaDbGtidLogDTO replaced getSequenceNumber with getMariaDbGtid
- Fixed: Insert NULL in a boolean column returns no rows
- Fixed: float problem about time field type
- Fixed: column order
- Changed: getFields and getMasterStatus returns no VO
- Changed: Column to ColumnDTO and added ColumnDTOCollection
- Changed: replaced getFields with getColumnDTOCollection in TableMap
- Added: more compatibility for mysql 5.5, 5.6, 5.7, maria 10 and 8.0
- Removed: makeConfigFromArray
Date: 4 years ago
Size: 1,357 bytes
 

Contents

Class file image Download
<?php
declare(strict_types=1);

namespace
MySQLReplication\Event\DTO;

use
MySQLReplication\Definitions\ConstEventsNames;
use
MySQLReplication\Event\EventInfo;

class
RotateDTO extends EventDTO
{
    private
$position;
    private
$nextBinlog;
    private
$type = ConstEventsNames::ROTATE;

    public function
__construct(
       
EventInfo $eventInfo,
       
int $position,
       
string $nextBinlog
   
) {
       
parent::__construct($eventInfo);

       
$this->position = $position;
       
$this->nextBinlog = $nextBinlog;
    }

    public function
getPosition(): int
   
{
        return
$this->position;
    }

    public function
getNextBinlog(): string
   
{
        return
$this->nextBinlog;
    }

    public function
getType(): string
   
{
        return
$this->type;
    }

    public function
__toString(): string
   
{
        return
PHP_EOL .
           
'=== Event ' . $this->getType() . ' === ' . PHP_EOL .
           
'Date: ' . $this->eventInfo->getDateTime() . PHP_EOL .
           
'Log position: ' . $this->eventInfo->getPos() . PHP_EOL .
           
'Event size: ' . $this->eventInfo->getSize() . PHP_EOL .
           
'Binlog position: ' . $this->position . PHP_EOL .
           
'Binlog filename: ' . $this->nextBinlog . PHP_EOL;
    }

    public function
jsonSerialize()
    {
        return
get_object_vars($this);
    }
}