0
모델에 새로운 삽입 후 저장된 속성을 가져 오는 데 문제가 있습니다.Doctrine 1 저장된 속성을 다시 돌려주지 않는 행을 저장합니다.
모델 :
<?php
abstract class BaseTeacher extends Doctrine_Record
{
public function setTableDefinition()
{
$this->setTableName('teacher');
$this->hasColumn('id', 'integer', null, array(
'unique' => true,
'primary' => true,
'type' => 'integer',
'autoincrement' => true,
));
$this->hasColumn('website', 'string', 512, array(
'type' => 'string',
'autoincrement' => true,
'length' => '512',
));
$this->hasColumn('doj', 'date', null, array(
'primary' => true,
'type' => 'date',
));
$this->hasColumn('isPermanent', 'boolean', null, array(
'default' => 0,
'type' => 'boolean',
));
$this->hasColumn('isTeaching', 'boolean', null, array(
'default' => 0,
'type' => 'boolean',
));
$this->hasColumn('empId', 'string', 512, array(
'type' => 'string',
'length' => '512',
));
$this->hasColumn('qualification', 'string', 512, array(
'type' => 'string',
'length' => '512',
));
$this->hasColumn('prevExperience', 'clob', null, array(
'type' => 'clob',
));
$this->hasColumn('status', 'string', 32, array(
'type' => 'string',
'length' => '32',
));
$this->hasColumn('college_id', 'integer', null, array(
'type' => 'integer',
));
$this->hasColumn('user_id', 'integer', null, array(
'type' => 'integer',
));
}
public function setUp()
{
parent::setUp();
$softdelete0 = new Doctrine_Template_SoftDelete(array(
'name' => 'deleted',
'type' => 'boolean',
'options' =>
array(
'default' => 0,
'notnull' => true,
),
));
$timestampable0 = new Doctrine_Template_Timestampable(array(
'created' =>
array(
'name' => 'created_at',
'type' => 'timestamp',
),
'updated' =>
array(
'name' => 'updated_at',
'type' => 'timestamp',
),
));
$this->actAs($softdelete0);
$this->actAs($timestampable0);
}
}
** 여기 내 코드입니다 : **
$teacher = new Teacher();
$teacher->college_id = $collegeId;
$teacher->user_id = $user->id;
$teacher->save();
print_r($teacher->id);
그것은 DB에 새 항목을 밀어하지만 나에게 새로운 생성 된 행의 재산을 포기하지 않을거야. 이것은 이상한 쿼리이지만 솔직히 이번이 내 시간을 죽였습니다.