Skip to content
Snippets Groups Projects
Unverified Commit 2e5ca546 authored by Thomas Flori's avatar Thomas Flori
Browse files

update reference

parent 7771e04f
No related branches found
Tags v1.0.0-beta.1
No related merge requests found
......@@ -7,6 +7,7 @@
* [AdapterInterface](#breytaadapterinterface)
* [BasicAdapter](#breytabasicadapter)
* [CallbackProgress](#breytacallbackprogress)
* [Migrations](#breytamigrations)
* [ProgressInterface](#breytaprogressinterface)
......@@ -93,6 +94,171 @@ Returns false on error and an integer of affected rows on success.
* http://php.net/manual/en/pdo.exec.php - for a details about the return statement
---
### Breyta\ProgressInterface
#### Methods
* [afterExecution](#breytaprogressinterfaceafterexecution) Output information about the $statement (after it gets executed)
* [afterMigration](#breytaprogressinterfaceaftermigration) Output information about the $migration (after the migration)
* [beforeExecution](#breytaprogressinterfacebeforeexecution) Output information about the $statement (before it gets executed)
* [beforeMigration](#breytaprogressinterfacebeforemigration) Output information about the $migration (before the migration)
* [finish](#breytaprogressinterfacefinish) Output information about what just happened
* [start](#breytaprogressinterfacestart) Output information about starting the migration process
#### Breyta\ProgressInterface::afterExecution
```php
public function afterExecution( \Breyta\Model\Statement $execution )
```
##### Output information about the $statement (after it gets executed)
**Visibility:** this method is **public**.
<br />
##### Parameters
| Parameter | Type | Description |
|-----------|------|-------------|
| `$execution` | **Model\Statement** | |
#### Breyta\ProgressInterface::afterMigration
```php
public function afterMigration( \Breyta\Model\Migration $migration )
```
##### Output information about the $migration (after the migration)
**Visibility:** this method is **public**.
<br />
##### Parameters
| Parameter | Type | Description |
|-----------|------|-------------|
| `$migration` | **Model\Migration** | |
#### Breyta\ProgressInterface::beforeExecution
```php
public function beforeExecution( \Breyta\Model\Statement $execution )
```
##### Output information about the $statement (before it gets executed)
**Visibility:** this method is **public**.
<br />
##### Parameters
| Parameter | Type | Description |
|-----------|------|-------------|
| `$execution` | **Model\Statement** | |
#### Breyta\ProgressInterface::beforeMigration
```php
public function beforeMigration( \Breyta\Model\Migration $migration )
```
##### Output information about the $migration (before the migration)
**Visibility:** this method is **public**.
<br />
##### Parameters
| Parameter | Type | Description |
|-----------|------|-------------|
| `$migration` | **Model\Migration** | |
#### Breyta\ProgressInterface::finish
```php
public function finish( \stdClass $info )
```
##### Output information about what just happened
Info contains:
- `migrations` - an array of Breyta\Model\Migration
- `task` - the task that is going to be executed (migrate or revert)
- `count` - an integer how many migrations are going to be executed
- `executed` - an array of migrations that just got executed
**Visibility:** this method is **public**.
<br />
##### Parameters
| Parameter | Type | Description |
|-----------|------|-------------|
| `$info` | **\stdClass** | |
#### Breyta\ProgressInterface::start
```php
public function start( \stdClass $info )
```
##### Output information about starting the migration process
Info contains:
- `migrations` - an array of Breyta\Model\Migration
- `task` - the task that is going to be executed (migrate or revert)
- `count` - an integer how many migrations are going to be executed
- `toExecute` - an array of migrations that are going to be executed
**Visibility:** this method is **public**.
<br />
##### Parameters
| Parameter | Type | Description |
|-----------|------|-------------|
| `$info` | **\stdClass** | |
---
### Breyta\Model\Migration
......@@ -164,7 +330,7 @@ public static function createInstance( array $data = array() )
---
### Breyta\ProgressInterface
### Breyta\Model\Statement
......@@ -174,24 +340,32 @@ public static function createInstance( array $data = array() )
#### Properties
| Visibility | Name | Type | Description |
|------------|------|------|---------------------------------------|
| **public** | `$raw` | **string** | |
| **public** | `$teaser` | **string** | |
| **public** | `$action` | **string** | |
| **public** | `$type` | **string** | |
| **public** | `$name` | **string** | |
| **public** | `$result` | **mixed** | |
| **public** | `$executionTime` | **double** | |
| **public** | `$exception` | ** \ PDOException** | |
#### Methods
* [afterExecution](#breytaprogressinterfaceafterexecution) Output information about the $statement (after it gets executed)
* [afterMigration](#breytaprogressinterfaceaftermigration) Output information about the $migration (after the migration)
* [beforeExecution](#breytaprogressinterfacebeforeexecution) Output information about the $statement (before it gets executed)
* [beforeMigration](#breytaprogressinterfacebeforemigration) Output information about the $migration (before the migration)
* [finish](#breytaprogressinterfacefinish) Output information about what just happened
* [start](#breytaprogressinterfacestart) Output information about starting the migration process
* [__toString](#breytamodelstatement__tostring)
* [createInstance](#breytamodelstatementcreateinstance)
#### Breyta\ProgressInterface::afterExecution
#### Breyta\Model\Statement::__toString
```php
public function afterExecution( \Breyta\Model\Statement $execution )
public function __toString()
```
##### Output information about the $statement (after it gets executed)
......@@ -199,21 +373,97 @@ public function afterExecution( \Breyta\Model\Statement $execution )
<br />
#### Breyta\Model\Statement::createInstance
```php
public static function createInstance( array $data = array() )
```
**Static:** this method is **static**.
<br />**Visibility:** this method is **public**.
<br />
##### Parameters
| Parameter | Type | Description |
|-----------|------|-------------|
| `$execution` | **Model\Statement** | |
| `$data` | **array** | |
---
### Breyta\Migrations
#### Breyta\ProgressInterface::afterMigration
The migration engine that puts all parts together.
#### Constants
| Name | Value |
|------|-------|
| INTERNAL_PREFIX | `'@breyta/'` |
#### Properties
| Visibility | Name | Type | Description |
|------------|------|------|---------------------------------------|
| **public static** | `$table` | **string** | The name of the migration table |
| **public static** | `$templatePath` | **string** | The path to the template for migrations |
| **protected** | `$db` | ** \ PDO** | |
| **protected** | `$path` | **string** | |
| **protected** | `$migrations` | **array &#124; array&lt;Model \ Migration>** | |
| **protected** | `$missingMigrations` | **array &#124; array&lt;Model \ Migration>** | |
| **protected** | `$statements` | **array &#124; array&lt;Model \ Statement>** | |
| **protected** | `$adapter` | **AdapterInterface** | |
| **protected** | `$resolver` | **callable** | |
| **protected** | `$progress` | **ProgressInterface** | |
#### Methods
* [__construct](#breytamigrations__construct)
* [createMigration](#breytamigrationscreatemigration) Creates a migration
* [down](#breytamigrationsdown) Revert specific migrations
* [executeStatement](#breytamigrationsexecutestatement)
* [findMigrations](#breytamigrationsfindmigrations)
* [getAdapter](#breytamigrationsgetadapter)
* [getProgress](#breytamigrationsgetprogress)
* [getStatus](#breytamigrationsgetstatus) Returns the status of the migrations
* [internalClass](#breytamigrationsinternalclass)
* [isInternal](#breytamigrationsisinternal)
* [loadMigrations](#breytamigrationsloadmigrations)
* [migrate](#breytamigrationsmigrate) Migrate all migrations that are not migrated yet
* [migrateTo](#breytamigrationsmigrateto) Migrate all migrations to a specific migration or date time
* [revert](#breytamigrationsrevert) Revert all migrations that have been migrated
* [revertTo](#breytamigrationsrevertto) Revert all migrations to a specific migration or date time
* [saveMigration](#breytamigrationssavemigration)
* [setProgress](#breytamigrationssetprogress)
* [up](#breytamigrationsup) Migrate specific migrations
#### Breyta\Migrations::__construct
```php
public function afterMigration( \Breyta\Model\Migration $migration )
public function __construct(
\PDO $db, \Breyta\string $path, callable $resolver = null,
\Breyta\ProgressInterface $progress = null
): Migrations
```
##### Output information about the $migration (after the migration)
......@@ -225,21 +475,69 @@ public function afterMigration( \Breyta\Model\Migration $migration )
| Parameter | Type | Description |
|-----------|------|-------------|
| `$migration` | **Model\Migration** | |
| `$db` | **\PDO** | |
| `$path` | **string** | |
| `$resolver` | **callable** | |
| `$progress` | **ProgressInterface** | |
#### Breyta\ProgressInterface::beforeExecution
#### Breyta\Migrations::createMigration
```php
public function beforeExecution( \Breyta\Model\Statement $execution )
public function createMigration( string $name ): boolean
```
##### Output information about the $statement (before it gets executed)
##### Creates a migration
We recommend StudlyCase naming for PSR2 compatibility. Also the files will get a namespace.
**Visibility:** this method is **public**.
<br />
**Returns**: this method returns **boolean**
<br />
##### Parameters
| Parameter | Type | Description |
|-----------|------|-------------|
| `$name` | **string** | |
#### Breyta\Migrations::down
```php
public function down( \Breyta\Model\Migration $migrations ): boolean
```
##### Revert specific migrations
**Visibility:** this method is **public**.
<br />
**Returns**: this method returns **boolean**
<br />
##### Parameters
| Parameter | Type | Description |
|-----------|------|-------------|
| `$migrations` | **Model\Migration** | |
#### Breyta\Migrations::executeStatement
```php
protected function executeStatement( \Breyta\Model\Statement $statement )
```
**Visibility:** this method is **protected**.
<br />
......@@ -247,21 +545,84 @@ public function beforeExecution( \Breyta\Model\Statement $execution )
| Parameter | Type | Description |
|-----------|------|-------------|
| `$execution` | **Model\Statement** | |
| `$statement` | **Model\Statement** | |
#### Breyta\ProgressInterface::beforeMigration
#### Breyta\Migrations::findMigrations
```php
public function beforeMigration( \Breyta\Model\Migration $migration )
protected function findMigrations()
```
##### Output information about the $migration (before the migration)
**Visibility:** this method is **protected**.
<br />
#### Breyta\Migrations::getAdapter
```php
protected function getAdapter()
```
**Visibility:** this method is **protected**.
<br />
#### Breyta\Migrations::getProgress
```php
public function getProgress()
```
**Visibility:** this method is **public**.
<br />
#### Breyta\Migrations::getStatus
```php
public function getStatus(): \stdClass
```
##### Returns the status of the migrations
It contains an array of all migrations, the count of migrations that are not migrated yet and an array of
migrations that got removed (if files where removed).
**Visibility:** this method is **public**.
<br />
**Returns**: this method returns **\stdClass**
<br />
#### Breyta\Migrations::internalClass
```php
protected static function internalClass( \Breyta\string $file )
```
**Static:** this method is **static**.
<br />**Visibility:** this method is **protected**.
<br />
......@@ -269,25 +630,21 @@ public function beforeMigration( \Breyta\Model\Migration $migration )
| Parameter | Type | Description |
|-----------|------|-------------|
| `$migration` | **Model\Migration** | |
| `$file` | **string** | |
#### Breyta\ProgressInterface::finish
#### Breyta\Migrations::isInternal
```php
public function finish( \stdClass $info )
protected static function isInternal( \Breyta\string $file )
```
##### Output information about what just happened
Info contains:
- `migrations` - an array of Breyta\Model\Migration
- `task` - the task that is going to be executed (migrate or revert)
- `count` - an integer how many migrations are going to be executed
- `executed` - an array of migrations that just got executed
**Visibility:** this method is **public**.
**Static:** this method is **static**.
<br />**Visibility:** this method is **protected**.
<br />
......@@ -295,96 +652,145 @@ Info contains:
| Parameter | Type | Description |
|-----------|------|-------------|
| `$info` | **\stdClass** | |
| `$file` | **string** | |
#### Breyta\ProgressInterface::start
#### Breyta\Migrations::loadMigrations
```php
public function start( \stdClass $info )
protected function loadMigrations()
```
##### Output information about starting the migration process
Info contains:
- `migrations` - an array of Breyta\Model\Migration
- `task` - the task that is going to be executed (migrate or revert)
- `count` - an integer how many migrations are going to be executed
- `toExecute` - an array of migrations that are going to be executed
**Visibility:** this method is **protected**.
<br />
#### Breyta\Migrations::migrate
```php
public function migrate(): boolean
```
##### Migrate all migrations that are not migrated yet
**Visibility:** this method is **public**.
<br />
**Returns**: this method returns **boolean**
<br />
#### Breyta\Migrations::migrateTo
```php
public function migrateTo( string $file ): boolean
```
##### Migrate all migrations to a specific migration or date time
$file can either be a relative file name (or a portion matched with `strpos()`) or a date time string to execute
all migrations to that time.
**Visibility:** this method is **public**.
<br />
**Returns**: this method returns **boolean**
<br />
##### Parameters
| Parameter | Type | Description |
|-----------|------|-------------|
| `$info` | **\stdClass** | |
| `$file` | **string** | |
#### Breyta\Migrations::revert
```php
public function revert(): boolean
```
---
##### Revert all migrations that have been migrated
### Breyta\Model\Statement
**Visibility:** this method is **public**.
<br />
**Returns**: this method returns **boolean**
<br />
#### Breyta\Migrations::revertTo
```php
public function revertTo( string $file ): boolean
```
##### Revert all migrations to a specific migration or date time
$file can either be a relative file name (or a portion matched with `strpos()`) or a date time string to execute
all migrations to that time.
#### Properties
**Note:** This will not revert the migration matched the pattern. It is resetting to the state of the database
to the state when <file> was executed.
| Visibility | Name | Type | Description |
|------------|------|------|---------------------------------------|
| **public** | `$raw` | **string** | |
| **public** | `$teaser` | **string** | |
| **public** | `$action` | **string** | |
| **public** | `$type` | **string** | |
| **public** | `$name` | **string** | |
| **public** | `$result` | **mixed** | |
| **public** | `$executionTime` | **double** | |
| **public** | `$exception` | ** \ PDOException** | |
**Visibility:** this method is **public**.
<br />
**Returns**: this method returns **boolean**
<br />
##### Parameters
| Parameter | Type | Description |
|-----------|------|-------------|
| `$file` | **string** | |
#### Methods
* [__toString](#breytamodelstatement__tostring)
* [createInstance](#breytamodelstatementcreateinstance)
#### Breyta\Model\Statement::__toString
#### Breyta\Migrations::saveMigration
```php
public function __toString()
protected function saveMigration(
\Breyta\Model\Migration $migration, $status, $executionTime
)
```
**Visibility:** this method is **public**.
**Visibility:** this method is **protected**.
<br />
##### Parameters
| Parameter | Type | Description |
|-----------|------|-------------|
| `$migration` | **Model\Migration** | |
| `$status` | | |
| `$executionTime` | | |
#### Breyta\Model\Statement::createInstance
#### Breyta\Migrations::setProgress
```php
public static function createInstance( array $data = array() )
public function setProgress( \Breyta\ProgressInterface $progress )
```
**Static:** this method is **static**.
<br />**Visibility:** this method is **public**.
**Visibility:** this method is **public**.
<br />
......@@ -392,7 +798,30 @@ public static function createInstance( array $data = array() )
| Parameter | Type | Description |
|-----------|------|-------------|
| `$data` | **array** | |
| `$progress` | **ProgressInterface** | |
#### Breyta\Migrations::up
```php
public function up( \Breyta\Model\Migration $migrations ): boolean
```
##### Migrate specific migrations
**Visibility:** this method is **public**.
<br />
**Returns**: this method returns **boolean**
<br />
##### Parameters
| Parameter | Type | Description |
|-----------|------|-------------|
| `$migrations` | **Model\Migration** | |
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment