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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.