Wednesday 15 February 2012

mysql - Doctrine 1 saving a row not giving back saved property -



mysql - Doctrine 1 saving a row not giving back saved property -

i finding problem in getting saved property after new insertion in model.

model :

<?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); } }

**here code : **

$teacher = new teacher(); $teacher->college_id = $collegeid; $teacher->user_id = $user->id; $teacher->save(); print_r($teacher->id);

it's pushing new entry in db not giving me new generated row's property. weird query killed time.

how aweful, regenerated models yml , worked.

mysql doctrine doctrine-1.2

No comments:

Post a Comment