I'm having problems with innerJoins with i18n tables, the doctrine not
putting the schema name in front table names..
my query is:
//busca as amenidades do hotel
$q = new Doctrine_Query();
$q->from('HotelFacility hf')
->innerJoin('hf.HotelFacilityType hft')
->innerJoin('hf.FacilityType ft')
# ->innerJoin('hft.Translation hft8')
# ->innerJoin('ft.Translation fttran')
->where('hf.hotel_id = ? and hf.value IS TRUE ', $this->id );
It's generating the sql:
SELECT
b.hotel_facility_type_id AS b__hotel_facility_type_id,
b.hotel_id AS b__hotel_id, b.facility_type_id AS b__facility_type_id,
b.value AS b__value, b2.id AS b2__id, b2.facility_type_id AS
b2__facility_type_id,
b2.type AS b2__type, b3.id AS b3__id
FROM booking.hotel_facility b
INNER JOIN booking.hotel_facility_type b2 ON b.hotel_facility_type_id
= b2.id
INNER JOIN booking.facility_type b3 ON b.facility_type_id = b3.id
WHERE (b.hotel_id = ? AND b.value IS TRUE)
but if I uncomment the innerJoin of translation tables, the table no
include the booking ( schema )
SELECT
b.hotel_facility_type_id AS b__hotel_facility_type_id, b.hotel_id AS
b__hotel_id, b.facility_type_id AS b__facility_type_id, b.value AS
b__value,
b2.id AS b2__id, b2.facility_type_id AS b2__facility_type_id, b2.type
AS b2__type, b3.id AS b3__id,
h.id AS h__id, h.name AS h__name, h.created_at AS h__created_at,
h.updated_at AS h__updated_at,
h.lang AS h__lang, f.id AS f__id, f.name AS f__name, f.created_at AS
f__created_at,
f.updated_at AS f__updated_at, f.lang AS f__lang
FROM booking.hotel_facility b
INNER JOIN booking.hotel_facility_type b2 ON b.hotel_facility_type_id
= b2.id
INNER JOIN booking.facility_type b3 ON b.facility_type_id = b3.id
INNER JOIN hotel_facility_type_translation h ON b2.id = h.id ---- NOT
USING SCHEMA
INNER JOIN facility_type_translation f ON b3.id = f.id ---- NOT USING
SCHEMA
WHERE (b.hotel_id = ? AND b.value IS TRUE)
> I'm having problems with innerJoins with i18n tables, the doctrine not
> putting the schema name in front table names..
> my query is:
> //busca as amenidades do hotel
> $q = new Doctrine_Query();
> $q->from('HotelFacility hf')
> ->innerJoin('hf.HotelFacilityType hft')
> ->innerJoin('hf.FacilityType ft')
> # ->innerJoin('hft.Translation hft8')
> # ->innerJoin('ft.Translation fttran')
> ->where('hf.hotel_id = ? and hf.value IS TRUE ', $this->id );
> It's generating the sql:
> SELECT
> b.hotel_facility_type_id AS b__hotel_facility_type_id,
> b.hotel_id AS b__hotel_id, b.facility_type_id AS b__facility_type_id,
> b.value AS b__value, b2.id AS b2__id, b2.facility_type_id AS
> b2__facility_type_id,
> b2.type AS b2__type, b3.id AS b3__id
> FROM booking.hotel_facility b
> INNER JOIN booking.hotel_facility_type b2 ON b.hotel_facility_type_id
> = b2.id
> INNER JOIN booking.facility_type b3 ON b.facility_type_id = b3.id
> WHERE (b.hotel_id = ? AND b.value IS TRUE)
> but if I uncomment the innerJoin of translation tables, the table no
> include the booking ( schema )
> SELECT
> b.hotel_facility_type_id AS b__hotel_facility_type_id, b.hotel_id AS
> b__hotel_id, b.facility_type_id AS b__facility_type_id, b.value AS
> b__value,
> b2.id AS b2__id, b2.facility_type_id AS b2__facility_type_id, b2.type
> AS b2__type, b3.id AS b3__id,
> h.id AS h__id, h.name AS h__name, h.created_at AS h__created_at,
> h.updated_at AS h__updated_at,
> h.lang AS h__lang, f.id AS f__id, f.name AS f__name, f.created_at AS
> f__created_at,
> f.updated_at AS f__updated_at, f.lang AS f__lang
> FROM booking.hotel_facility b
> INNER JOIN booking.hotel_facility_type b2 ON b.hotel_facility_type_id
> = b2.id
> INNER JOIN booking.facility_type b3 ON b.facility_type_id = b3.id
> INNER JOIN hotel_facility_type_translation h ON b2.id = h.id ---- NOT
> USING SCHEMA
> INNER JOIN facility_type_translation f ON b3.id = f.id ---- NOT USING
> SCHEMA
> WHERE (b.hotel_id = ? AND b.value IS TRUE)