/**
  * @param array $fields fields of referencing table that reference primary another table
  * @param DBTable $referencedTable object that represents referenced table
  * @param AssociationBreakAction $associationBreakAction action which is performed on reference break
  */
 function __construct($name, DBTable $table, array $fields, DBTable $referencedTable, AssociationBreakAction $associationBreakAction)
 {
     foreach ($referencedTable->getConstraints() as $constraint) {
         if ($constraint instanceof DBPrimaryKeyConstraint) {
             $pkFields = $constraint->getFields();
             Assert::isTrue(sizeof($pkFields) == sizeof($fields), 'foreign key (%s) should have the same number of columns as %s`s table primary key (%s)', join(', ', $fields), $referencedTable->getName(), join(', ', $pkFields));
             $this->fields = new SqlFieldArray($fields);
             $this->pkFields = new SqlFieldArray($pkFields);
             $this->referencedTable = $referencedTable;
             $this->associationBreakAction = $associationBreakAction;
             parent::__construct($name, $table, $fields);
             return;
         }
     }
     Assert::isUnreachable('referenced table `%s` MUST contain DBPrimaryKeyConstraint', $referencedTable->getName());
 }