/** * Removes this object from datastore and sets delete attribute. * * @param ConnectionInterface $con * @return void * @throws PropelException * @see Profile::setDeleted() * @see Profile::isDeleted() */ public function delete(ConnectionInterface $con = null) { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); } if ($con === null) { $con = Propel::getServiceContainer()->getWriteConnection(ProfileTableMap::DATABASE_NAME); } $con->transaction(function () use($con) { $deleteQuery = ChildProfileQuery::create()->filterByPrimaryKey($this->getPrimaryKey()); $ret = $this->preDelete($con); if ($ret) { $deleteQuery->delete($con); $this->postDelete($con); $this->setDeleted(true); } }); }
/** * Gets a single ChildProfile object, which is related to this object by a one-to-one relationship. * * @param ConnectionInterface $con optional connection object * @return ChildProfile * @throws PropelException */ public function getProfile(ConnectionInterface $con = null) { if ($this->singleProfile === null && !$this->isNew()) { $this->singleProfile = ChildProfileQuery::create()->findPk($this->getPrimaryKey(), $con); } return $this->singleProfile; }