mirror of
https://github.com/standardebooks/web.git
synced 2025-07-07 07:10:29 -04:00
update-ebook-database: Keys aren't always integers
This commit is contained in:
parent
4d321061c5
commit
d5748d1006
1 changed files with 4 additions and 4 deletions
|
@ -17,14 +17,14 @@ function findObjectDifferences($fs, $db): array{
|
||||||
// Property starts with underscore, remove the underscore and call __get()
|
// Property starts with underscore, remove the underscore and call __get()
|
||||||
$propertyNameWithoutUnderscore = substr($fsProperty->getName(), 1);
|
$propertyNameWithoutUnderscore = substr($fsProperty->getName(), 1);
|
||||||
if(is_array($fs->$propertyNameWithoutUnderscore) && is_array($db->$propertyNameWithoutUnderscore)){
|
if(is_array($fs->$propertyNameWithoutUnderscore) && is_array($db->$propertyNameWithoutUnderscore)){
|
||||||
for($i = 0; $i < count($fsProperty->getValue($fs)); $i++){
|
foreach($fsProperty->getValue($fs) as $key => $value){
|
||||||
if(is_object($fsProperty->getValue($fs)[$i])){
|
if(is_object($fsProperty->getValue($fs)[$key])){
|
||||||
$arrayDiff = findObjectDifferences($fsProperty->getValue($fs)[$i], $dbProperty->getValue($db)[$i]);
|
$arrayDiff = findObjectDifferences($fsProperty->getValue($fs)[$key], $dbProperty->getValue($db)[$key]);
|
||||||
if(!empty($arrayDiff)){
|
if(!empty($arrayDiff)){
|
||||||
$diffs[$fsProperty->getName()] = $arrayDiff;
|
$diffs[$fsProperty->getName()] = $arrayDiff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if($fsProperty->getValue($fs)[$i] != $dbProperty->getValue($db)[$i]){
|
else if($fsProperty->getValue($fs)[$key] != $dbProperty->getValue($db)[$key]){
|
||||||
$diffs[$fsProperty->getName()] = ["fs" => $fsProperty->getValue($fs), "db" => $dbProperty->getValue($db)];
|
$diffs[$fsProperty->getName()] = ["fs" => $fsProperty->getValue($fs), "db" => $dbProperty->getValue($db)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue