/**
  * Add foreign keys to entity table
  *
  * @return void
  */
 protected function addForeignKeys()
 {
     $foreignKeys = $this->setup->getConnection()->getForeignKeys(
         $this->setup->getTable($this->entityTable)
     );
     $foreignKeys = array_filter(
         $foreignKeys,
         function ($key) {
             return $key['COLUMN_NAME'] == $this->entityColumn;
         }
     );
     foreach ($foreignKeys as $foreignKeyInfo) {
         if (!count($this->getForeignKeys(
             $this->externalTable,
             $this->externalColumn,
             $this->setup->getTablePlaceholder($foreignKeyInfo['REF_TABLE_NAME']),
             $foreignKeyInfo['REF_COLUMN_NAME']
         ))) {
             $this->setup->getConnection()->addForeignKey(
                 $this->setup->getFkName(
                     $this->externalTable,
                     $this->externalColumn,
                     $this->setup->getTablePlaceholder($foreignKeyInfo['REF_TABLE_NAME']),
                     $foreignKeyInfo['REF_COLUMN_NAME']
                 ),
                 $this->setup->getTable($this->externalTable),
                 $this->externalColumn,
                 $foreignKeyInfo['REF_TABLE_NAME'],
                 $foreignKeyInfo['REF_COLUMN_NAME'],
                 $this->onDelete
             );
         }
     }
 }