lina11
Новичок
Необходимо выбрать поля таблицы tab1 и поле sifr из таблицы tab2.Схема такая:
config/doctrine/schema.yml
1) В методе setup() класса BasebazaTab1.class.php:
HTML
2) В методе setup() класса BasebazaTab2.class.php:
HTML
Сам запрос на симфони:
выдает данные только из 1-й таблицы Tab1.
в ЧЕМ ДЕЛО?
config/doctrine/schema.yml
PHP:
---
bazaTab1:
actAs:
Timestampable: ~
columns:
date:
type: date
code_id:
type: integer
notnull: true
... .... .......
relations:
bazatab1:
local: code_id
foreign: id
type: one
foreignType: many
bazaTab2:
actAs:
Timestampable: ~
columns:
name:
type: string(32)
notnull: true
shifr:
type: int(4)
notnull: true
HTML
PHP:
public function setUp()
{
parent::setUp();
$this->hasOne('bazaTab2', array(
'local' => 'code_id',
'foreign' => 'id'));
$timestampable0 = new Doctrine_Template_Timestampable();
$this->actAs($timestampable0);
}
HTML
PHP:
public function setUp()
{
parent::setUp();
$this->hasMany('bazaTab1', array(
'local' => 'id',
'foreign' => 'code_id'));
$timestampable0 = new Doctrine_Template_Timestampable();
$this->actAs($timestampable0);
}
PHP:
$q = Doctrine_Query::create()
->from('bazaTab1 o, o.bazaTab2 o2')
->where('o.code_id=?','o2.id')
->Andwhere('o.date = ?', '2010-12-22') ;
$this->result=$q->execute();
в ЧЕМ ДЕЛО?