Jump to content

save() not saving


helloise

Recommended Posts

$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???

Link to comment
https://forums.phpfreaks.com/topic/232399-save-not-saving/
Share on other sites

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???

Link to comment
https://forums.phpfreaks.com/topic/232399-save-not-saving/#findComment-1195489
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.