Files
pathfinder/app/Db/Sql/Mysql/Column.php
Sam 98bd07e904 Merge Development Branch v2.1.2 (#21)
* Fixes environment default

* Bump clue/ndjson-react from 1.1.0 to 1.2.0

Bumps [clue/ndjson-react](https://github.com/clue/reactphp-ndjson) from 1.1.0 to 1.2.0.
- [Release notes](https://github.com/clue/reactphp-ndjson/releases)
- [Changelog](https://github.com/clue/reactphp-ndjson/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clue/reactphp-ndjson/compare/v1.1.0...v1.2.0)

---
updated-dependencies:
- dependency-name: clue/ndjson-react
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump cache/array-adapter from 1.0.1 to 1.1.0

Bumps [cache/array-adapter](https://github.com/php-cache/array-adapter) from 1.0.1 to 1.1.0.
- [Release notes](https://github.com/php-cache/array-adapter/releases)
- [Changelog](https://github.com/php-cache/array-adapter/blob/master/Changelog.md)
- [Commits](https://github.com/php-cache/array-adapter/compare/1.0.1...1.1.0)

---
updated-dependencies:
- dependency-name: cache/array-adapter
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump monolog/monolog from 2.3.2 to 2.3.4

Bumps [monolog/monolog](https://github.com/Seldaek/monolog) from 2.3.2 to 2.3.4.
- [Release notes](https://github.com/Seldaek/monolog/releases)
- [Changelog](https://github.com/Seldaek/monolog/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Seldaek/monolog/compare/2.3.2...2.3.4)

---
updated-dependencies:
- dependency-name: monolog/monolog
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump cache/namespaced-cache from 1.0.0 to 1.1.0

Bumps [cache/namespaced-cache](https://github.com/php-cache/namespaced-cache) from 1.0.0 to 1.1.0.
- [Release notes](https://github.com/php-cache/namespaced-cache/releases)
- [Changelog](https://github.com/php-cache/namespaced-cache/blob/master/Changelog.md)
- [Commits](https://github.com/php-cache/namespaced-cache/compare/1.0.0...1.1.0)

---
updated-dependencies:
- dependency-name: cache/namespaced-cache
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump gulp-sass from 4.1.1 to 5.0.0

Bumps [gulp-sass](https://github.com/dlmanning/gulp-sass) from 4.1.1 to 5.0.0.
- [Release notes](https://github.com/dlmanning/gulp-sass/releases)
- [Changelog](https://github.com/dlmanning/gulp-sass/blob/master/CHANGELOG.md)
- [Commits](https://github.com/dlmanning/gulp-sass/compare/v4.1.1...v5.0.0)

---
updated-dependencies:
- dependency-name: gulp-sass
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump node-sass from 4.14.1 to 6.0.1

Bumps [node-sass](https://github.com/sass/node-sass) from 4.14.1 to 6.0.1.
- [Release notes](https://github.com/sass/node-sass/releases)
- [Changelog](https://github.com/sass/node-sass/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sass/node-sass/compare/v4.14.1...v6.0.1)

---
updated-dependencies:
- dependency-name: node-sass
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump gulp-brotli from 2.0.2 to 3.0.0

Bumps [gulp-brotli](https://github.com/seznam/gulp-brotli) from 2.0.2 to 3.0.0.
- [Release notes](https://github.com/seznam/gulp-brotli/releases)
- [Commits](https://github.com/seznam/gulp-brotli/compare/v2.0.2...v3.0.0)

---
updated-dependencies:
- dependency-name: gulp-brotli
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump imagemin-webp from 5.1.0 to 6.0.0

Bumps [imagemin-webp](https://github.com/imagemin/imagemin-webp) from 5.1.0 to 6.0.0.
- [Release notes](https://github.com/imagemin/imagemin-webp/releases)
- [Commits](https://github.com/imagemin/imagemin-webp/compare/v5.1.0...v6.0.0)

---
updated-dependencies:
- dependency-name: imagemin-webp
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix: make pathfinder composer 2.x compliant

extract mixed class into dedicated file and address filename typo in order to make the project PSR-4 compliant and work with Composer 2

* Bump league/html-to-markdown from 4.9.1 to 5.0.1

Bumps [league/html-to-markdown](https://github.com/thephpleague/html-to-markdown) from 4.9.1 to 5.0.1.
- [Release notes](https://github.com/thephpleague/html-to-markdown/releases)
- [Changelog](https://github.com/thephpleague/html-to-markdown/blob/master/CHANGELOG.md)
- [Commits](https://github.com/thephpleague/html-to-markdown/compare/4.9.1...5.0.1)

---
updated-dependencies:
- dependency-name: league/html-to-markdown
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* composer.json: bumps monolog to 2.3.4

* composer.lock: Updates after dependabot merges

* Adds package-lock.json

* .gitignore: removes package-lock.json from ignore

* Removes "slash" js dev dependency

* pathfinder.ini: bumps version

* Bumps version on public files

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Loïc LEUILLIOT <loic.leuilliot@gmail.com>
2021-09-18 18:39:37 +12:00

81 lines
2.2 KiB
PHP

<?php
namespace Exodus4D\Pathfinder\Db\Sql\Mysql;
use DB\SQL;
/**
* Class Column
* @package DB\SQL\MySQL
*/
class Column extends SQL\Column
{
const TEXT_TableNameMissing = 'Table name missing for FOREIGN KEY in `%s`';
/**
* drop constraint from this column
* @param Constraint $constraint
*/
public function dropConstraint(Constraint $constraint)
{
$this->table->dropConstraint($constraint);
}
/**
* add constraint to this column
* @param Constraint $constraint
*/
public function addConstraint(Constraint $constraint)
{
$this->table->addConstraint($constraint);
}
/**
* @param Constraint $constraint
* @return mixed
*/
public function constraintExists(Constraint $constraint)
{
return $this->table->constraintExists($constraint);
}
/**
* get a new column based constraint
* $constraintData['table'] => referenceTable name (required)
* $constraintData['id'] => referenceColumns (optional) default: ['id']
* $constraintData['on-delete'] => ON DELETE action (optional) default: see \DB\SQL\MySQL\Constraint const
* $constraintData['on-update'] => ON UPDATE action (optional) default: see \DB\SQL\MySQL\Constraint const
*
* @param array $constraintData
* @return Constraint
*/
public function newConstraint($constraintData)
{
$constraint = null;
if (isset($constraintData['table'])) {
if (isset($constraintData['column'])) {
$constraintData['column'] = (array)$constraintData['column'];
} else {
$constraintData['column'] = ['id'];
}
$constraint = new Constraint($this->table, $this->name, $constraintData['table'], $constraintData['column']);
if (isset($constraintData['on-delete'])) {
$constraint->setOnDelete($constraintData['on-delete']);
}
if (isset($constraintData['on-update'])) {
$constraint->setOnUpdate($constraintData['on-update']);
}
} else {
trigger_error(sprintf(self::TEXT_TableNameMissing, $this->table->name . '->' . $this->name));
}
return $constraint;
}
}