protected function attributesCompare(EntityInterface $entityA, EntityInterface $entityB, $atribute) { if (!$entityA->schemaHasKey($atribute)) { throw new InvalidArgumentException('Atributo inexistente!'); } $method = 'get' . ucfirst($atribute); return $entityA->{$method}() !== $entityB->{$method}(); }
protected function attributesCompare(EntityInterface $entityA, EntityInterface $entityB, $atribute) { if (!$entityA->schemaHasKey($atribute)) { throw new InvalidArgumentException('Atributo inexistente!'); } $method = 'get' . ucfirst($atribute); $data = ['a' => $entityA->{$method}(), 'b' => $entityB->{$method}()]; if ($data['a'] instanceof CollectionAbstract) { $data['a'] = $data['a']->toJson(); $data['b'] = $data['b']->toJson(); } $data['isDiff'] = $data['a'] !== $data['b']; return $data['isDiff']; }