I create Query\Builder and after all operations I have Phql like this
"SELECT Event\Model\Events.events_id AS id, Event\Model\Events.name AS name, Event\Model\Events.start_date AS start, Event\Model\Events.event_status AS status, Members.name AS member, Members.members_id AS member_id FROM [Event\Model\Events] LEFT JOIN [\Event\Model\Members] AS [Members] ON Event\Model\Events.members_id = Members.members_id WHERE (((Event\Model\Events.name LIKE 'event%')) AND (Event\Model\Events.members_id = 3)) AND ((Event\Model\Events.event_status = '0')) ORDER BY id desc"
but after execute this query I have Fatal error
"Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'name' in where clause is ambiguous' in"
and in profiler I see query
"SELECT events
.events_id
AS id
, events
.name
AS name
, events
.start_date
AS start
, events
.event_status
AS status
, Members
.name
AS member
, Members
.members_id
AS member_id
FROM events
LEFT JOIN members
AS Members
ON events
.members_id
= Members
.members_id
WHERE (((name
LIKE 'event%')) AND (events
.members_id
= 3)) AND ((events
.event_status
= '0')) ORDER BY id
"
if I change alias for column name
to namer
"SELECT Event\Model\Events.events_id AS id, Event\Model\Events.name AS namer, Event\Model\Events.start_date AS start, Event\Model\Events.event_status AS status, Members.name AS member, Members.members_id AS member_id FROM [Event\Model\Events] LEFT JOIN [\Event\Model\Members] AS [Members] ON Event\Model\Events.members_id = Members.members_id WHERE (((Event\Model\Events.name LIKE 'event%')) AND (Event\Model\Events.members_id = 3)) AND ((Event\Model\Events.event_status = '0')) ORDER BY id desc"
and in profiler query
"SELECT events
.events_id
AS id
, events
.name
AS namer
, events
.start_date
AS start
, events
.event_status
AS status
, Members
.name
AS member
, Members
.members_id
AS member_id
FROM events
LEFT JOIN members
AS Members
ON events
.members_id
= Members
.members_id
WHERE (((events
.name
LIKE 'event%')) AND (events
.members_id
= 3)) AND ((events
.event_status
= '0')) ORDER BY id
"
Query executed success