I wrote a join query that works as expected, but I can't figure out how to select from the joined table.
Produces:
I was expecting to see the user's ID as well.
PHP Code:
$where = array("type" => "Post", "user.preferredName" => "...");
$select = array("user.id","id");
$notes = $this->entityManager->getRDBRepository("Note")
->leftJoin("user", "user", ["user.id:" => "createdById"])
->select($select)->where($where)->find();
foreach($notes as $note)
$GLOBALS["log"]->debug("post",[$note->toArray()]);
Produces:
Code:
[2022-09-28 12:10:11] DEBUG: ["SELECT user.id AS `user.id`, note.id AS `id` FROM `note` ... [2022-09-28 12:08:33] DEBUG: post [{"id":"6331e96d0d639be6d"}] []
Comment