Are there alternative approaches to using JOIN statements in PHP to retrieve data from multiple tables without sacrificing object-oriented design?

When working with object-oriented design in PHP, using JOIN statements to retrieve data from multiple tables can sometimes lead to complex queries and potentially sacrificing the principles of object-oriented programming. One alternative approach is to utilize ORM (Object-Relational Mapping) libraries such as Doctrine or Eloquent, which abstract the database interactions and allow for more seamless querying and retrieval of data from multiple tables while maintaining object-oriented design principles.

// Using Eloquent ORM to retrieve data from multiple tables without sacrificing object-oriented design

// Define models for each table
class User extends Model {
    public function posts() {
        return $this->hasMany('App\Post');
    }
}

class Post extends Model {
    public function user() {
        return $this->belongsTo('App\User');
    }
}

// Retrieve data using Eloquent relationships
$user = User::find(1);
$posts = $user->posts;