So, so I understand that phalcon doesnt handle joins like other framewoks. But I would still like to format my data like that for ease of development.
When querying for all the servers of a single user, Phalcon returns multiple of the same user for each server, I would like to format it so when I have 1 that user contains all the servers they have. Like so:
Object Users extends Phalcon\Mvc\Model (
->id (public) = Numeric string (1) "1"
->username (public) = String (5) "admin"
->ip_address (public) = String (9) "127.0.0.1"
->first_name (public) = String (3) "The"
->last_name (public) = String (5) "Admin"
->premium (public) = Numeric string (1) "1"
->suspended (public) = Numeric string (1) "0"
->suspension_expiry (public) = NULL
->suspension_reason (public) = NULL
->created_at (public) = String (19) "2017-09-26 21:47:20"
->updated_at (public) = String (19) "2017-09-26 21:47:20"
->servers (public) = Object Phalcon\Mvc\Model\Resultset\Complex extends Phalcon\Mvc\Model\Resultset (
Object Servers extends Phalcon\Mvc\Model (
->id (public) = Numeric string (1) "1"
->owned_by (public) = Numeric string (1) "1"
->posted_by (public) = Numeric string (1) "2"
->type (public) = Numeric string (1) "1"
->ip (public) = String (13) "151.80.109.86"
->port (public) = Numeric string (4) "9987"
->query_port (public) = Numeric string (5) "10011"
->players (public) = NULL
->max_players (public) = Numeric string (3) "512"
->description (public) = NULL
->map (public) = NULL
->unlisted (public) = Numeric string (1) "0"
->created_at (public) = String (19) "2017-09-26 21:47:21"
->updated_at (public) = String (19) "2017-09-26 21:47:21"
)
Object Servers extends Phalcon\Mvc\Model (
->id (public) = Numeric string (1) "2"
->owned_by (public) = Numeric string (1) "1"
->posted_by (public) = Numeric string (1) "1"
->type (public) = Numeric string (1) "2"
->ip (public) = String (13) "151.80.109.86"
->port (public) = Numeric string (5) "27015"
->query_port (public) = Numeric string (5) "27015"
->players (public) = NULL
->max_players (public) = Numeric string (3) "512"
->description (public) = NULL
->map (public) = NULL
->unlisted (public) = Numeric string (1) "0"
->created_at (public) = String (19) "2017-09-26 21:47:21"
->updated_at (public) = String (19) "2017-09-26 21:47:21"
)
)
How can I acheive this with phalcon?
Im trying to acheive somelike how how Doctrine and Eloquent handle joins, Where the joined table is a child container (resultset in phalcons case) instead of multiple of the same user with diffrent joined servers.