This commit is contained in:
Greyscale 2020-03-03 12:23:36 +01:00
parent d1384f244b
commit d809e308fe
2 changed files with 6 additions and 8 deletions

View file

@ -51,19 +51,17 @@ class Model extends Entity
}
/**
* @param Model[] $models
* @param array $keyMap
* @param Model[] $models
* @param array $keyMap
* @param ConstraintObject[] $zendConstraints
*/
public function computeConstraints(array $models, array $keyMap, array $zendConstraints): self
{
/** @var Model[] $models */
//echo "Computing the constraints of {$this->getClassName()}\n";
foreach ($zendConstraints as $zendConstraint) {
if ('FOREIGN KEY' == $zendConstraint->getType()) {
//\Kint::dump($this->getTable(), $this->getClassPrefix(), $zendConstraint->getTableName());
$keyMapId = $zendConstraint->getReferencedTableSchema() . "::" . $zendConstraint->getReferencedTableName();
$keyMapId = $zendConstraint->getReferencedTableSchema().'::'.$zendConstraint->getReferencedTableName();
$relatedModel = $models[$keyMap[$keyMapId]];
//\Kint::dump(array_keys($models), $zendConstraint, $relatedModel);exit;
@ -198,7 +196,7 @@ class Model extends Entity
//echo " > l: {$relatedObject->getLocalClass()} :: {$relatedObject->getLocalBoundColumn()}\n";
//echo "\n";
// @var Model $remoteModel
if(!isset($models[$relatedObject->getRemoteClass()])){
if (!isset($models[$relatedObject->getRemoteClass()])) {
\Kint::dump(array_keys($models));
}
$models[$relatedObject->getRemoteClass()]

View file

@ -197,7 +197,7 @@ class RelatedModel extends Entity
public function getLocalClass(): string
{
return $this->getClassPrefix() .
return $this->getClassPrefix().
$this->transCamel2Studly->transform($this->getLocalTableSanitised());
}
@ -220,7 +220,7 @@ class RelatedModel extends Entity
public function getRemoteClass(): string
{
return $this->getClassPrefix() .
return $this->getClassPrefix().
$this->transCamel2Studly->transform($this->getRemoteTableSanitised());
}