helloise Posted April 1, 2011 Share Posted April 1, 2011 $new_relation->save(); echo "after save".$requestor_profile->getId()." ".$requestee_profile->getId(); return true; }catch(PropelException $e) { echo "in die"; die($e); return false; } }//end - if (!$res) [/code] the echo after the save executes but when i look in my db table there is nothing???? please help??? Quote Link to comment https://forums.phpfreaks.com/topic/232399-save-not-saving/ Share on other sites More sharing options...
Adam Posted April 1, 2011 Share Posted April 1, 2011 We can't help you with that much information. How are we supposed to know what the $new_relation object is, how the save() method works, etc. ? Quote Link to comment https://forums.phpfreaks.com/topic/232399-save-not-saving/#findComment-1195485 Share on other sites More sharing options...
helloise Posted April 1, 2011 Author Share Posted April 1, 2011 oops the copy/paste did not paste all my code??? here it is again: $res = RcProfileRelationTablePeer::hasRelation($requestor_profile->getId(), $requestee_profile->getId()); if(!$res) { try { $new_relation = new RcProfileRelationTable(); $new_relation->setProfileId($requestor_profile->getId()); $new_relation->setProfileIdContact($requestee_profile->getId()); $new_relation->save(); echo "after save".$requestor_profile->getId()." ".$requestee_profile->getId(); return true; }catch(PropelException $e) { die($e); return false; } }//end - if (!$res) else { return true; } here is the save part public function save(PropelPDO $con = null) { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); } if ($con === null) { $con = Propel::getConnection(RcProfileRelationTablePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } $con->beginTransaction(); $isInsert = $this->isNew(); try { $ret = $this->preSave($con); // symfony_behaviors behavior foreach (sfMixer::getCallables('BaseRcProfileRelationTable:save:pre') as $callable) { if (is_integer($affectedRows = call_user_func($callable, $this, $con))) { return $affectedRows; } } // symfony_timestampable behavior if ($isInsert) { $ret = $ret && $this->preInsert($con); // symfony_timestampable behavior if (!$this->isColumnModified(RcProfileRelationTablePeer::CREATED_AT)) { $this->setCreatedAt(time()); } } else { $ret = $ret && $this->preUpdate($con); } if ($ret) { $affectedRows = $this->doSave($con); if ($isInsert) { $this->postInsert($con); } else { $this->postUpdate($con); } $this->postSave($con); // symfony_behaviors behavior foreach (sfMixer::getCallables('BaseRcProfileRelationTable:save:post') as $callable) { call_user_func($callable, $this, $con, $affectedRows); } RcProfileRelationTablePeer::addInstanceToPool($this); } else { $affectedRows = 0; } $con->commit(); return $affectedRows; } catch (PropelException $e) { $con->rollBack(); throw $e; } } hope this helps??? Quote Link to comment https://forums.phpfreaks.com/topic/232399-save-not-saving/#findComment-1195489 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.