Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
RealTypes.php
Go to the documentation of this file.
1 <?php
7 
11 
18 {
22  const ERROR_TYPE = 'real_type_basis_error';
23 
27  const ERROR_MESSAGE = 'Real type "precision" must be greater or equal to "scale". %s(%s,%s) is invalid in %s.';
28 
32  public function validate(Schema $schema)
33  {
34  $errors = [];
35  foreach ($schema->getTables() as $table) {
36  foreach ($table->getColumns() as $column) {
37  if ($column instanceof Real) {
38  if ($column->getScale() > $column->getPrecision()) {
39  $errors[] = [
40  'column' => $table->getName() . '.' . $column->getName(),
41  'message' => sprintf(
42  self::ERROR_MESSAGE,
43  $column->getType(),
44  $column->getPrecision(),
45  $column->getScale(),
46  $table->getName() . '.' . $column->getName()
47  )
48  ];
49  }
50  }
51  }
52  }
53 
54  return $errors;
55  }
56 }
$table
Definition: trigger.php:14
$errors
Definition: overview.phtml:9