private function isValidProperty(string $property, EntityInterface $meta) : bool { if ($meta->properties()->contains($property)) { return true; } $property = new Str($property); if (!$property->match('/[a-zA-Z]+(\\.[a-zA-Z]+)+/')) { return false; } $pieces = $property->split('.'); $piece = (string) $pieces->get(0); if (!$meta->children()->contains($piece)) { return false; } $child = $meta->children()->get($piece); $relationship = $child->relationship(); switch ($pieces->count()) { case 2: return $relationship->properties()->contains((string) $pieces->get(1)); case 3: $subPiece = (string) $pieces->get(1); if (!$relationship->childProperty() === $subPiece) { return false; } return $child->properties()->contains((string) $pieces->get(2)); } return false; }