Code Duplication    Length = 12-14 lines in 4 locations

Alpha/Model/ActiveRecordProviderMySQL.php 2 locations

@@ 278-291 (lines=14) @@
275
            self::$logger->warn('Bad data stored in the table ['.$this->BO->getTableName().'], field ['.$propObj->name.'] bad value['.$row[$propObj->name].'], exception ['.$e->getMessage().']');
276
        } catch (PHPException $e) {
277
            // it is possible that the load failed due to the table not being up-to-date
278
            if ($this->BO->checkTableNeedsUpdate()) {
279
                $missingFields = $this->BO->findMissingFields();
280
281
                $count = count($missingFields);
282
283
                for ($i = 0; $i < $count; ++$i) {
284
                    $this->BO->addProperty($missingFields[$i]);
285
                }
286
287
                throw new RecordNotFoundException('Failed to load object of OID ['.$OID.'], table ['.$this->BO->getTableName().'] was out of sync with the database so had to be updated!');
288
                self::$logger->warn('<<load');
289
290
                return;
291
            }
292
        }
293
294
        self::$logger->debug('<<load ['.$OID.']');
@@ 449-462 (lines=14) @@
446
            self::$logger->warn('Bad data stored in the table ['.$this->BO->getTableName().'], field ['.$propObj->name.'] bad value['.$row[$propObj->name].'], exception ['.$e->getMessage().']');
447
        } catch (PHPException $e) {
448
            // it is possible that the load failed due to the table not being up-to-date
449
            if ($this->BO->checkTableNeedsUpdate()) {
450
                $missingFields = $this->BO->findMissingFields();
451
452
                $count = count($missingFields);
453
454
                for ($i = 0; $i < $count; ++$i) {
455
                    $this->BO->addProperty($missingFields[$i]);
456
                }
457
458
                throw new RecordNotFoundException('Failed to load object by attribute ['.$attribute.'] and value ['.$value.'], table ['.$this->BO->getTableName().'] was out of sync with the database so had to be updated!');
459
                self::$logger->debug('<<loadByAttribute');
460
461
                return;
462
            }
463
        }
464
465
        self::$logger->debug('<<loadByAttribute');

Alpha/Model/ActiveRecordProviderSQLite.php 2 locations

@@ 272-283 (lines=12) @@
269
            self::$logger->warn('Bad data stored in the table ['.$this->BO->getTableName().'], field ['.$propObj->name.'] bad value['.$row[$propObj->name].'], exception ['.$e->getMessage().']');
270
        } catch (PHPException $e) {
271
            // it is possible that the load failed due to the table not being up-to-date
272
            if ($this->BO->checkTableNeedsUpdate()) {
273
                $missingFields = $this->BO->findMissingFields();
274
275
                $count = count($missingFields);
276
277
                for ($i = 0; $i < $count; ++$i) {
278
                    $this->BO->addProperty($missingFields[$i]);
279
                }
280
281
                self::$logger->debug('<<load');
282
                throw new RecordFoundException('Failed to load object of OID ['.$OID.'], table ['.$this->BO->getTableName().'] was out of sync with the database so had to be updated!');
283
            }
284
        }
285
286
        self::$logger->debug('<<load');
@@ 434-445 (lines=12) @@
431
            self::$logger->warn('Bad data stored in the table ['.$this->BO->getTableName().'], field ['.$propObj->name.'] bad value['.$row[$propObj->name].'], exception ['.$e->getMessage().']');
432
        } catch (PHPException $e) {
433
            // it is possible that the load failed due to the table not being up-to-date
434
            if ($this->BO->checkTableNeedsUpdate()) {
435
                $missingFields = $this->BO->findMissingFields();
436
437
                $count = count($missingFields);
438
439
                for ($i = 0; $i < $count; ++$i) {
440
                    $this->BO->addProperty($missingFields[$i]);
441
                }
442
443
                self::$logger->debug('<<loadByAttribute');
444
                throw new RecordNotFoundException('Failed to load object by attribute ['.$attribute.'] and value ['.$value.'], table ['.$this->BO->getTableName().'] was out of sync with the database so had to be updated!');
445
            }
446
        }
447
448
        self::$logger->debug('<<loadByAttribute');