/** * Find object by primary key * <code> * $obj = $c->findPk(array(12, 34), $con); * </code> * @param array[$from_own_node_id, $to_own_node_id] $key Primary key to use for the query * @param PropelPDO $con an optional connection object * * @return MeshingTrustLocal|array|mixed the result, formatted by the current formatter */ public function findPk($key, $con = null) { if (null !== ($obj = MeshingTrustLocalPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1])))) && $this->getFormatter()->isObjectFormatter()) { // the object is alredy in the instance pool return $obj; } else { // the object has not been requested yet, or the formatter is not an object formatter $criteria = $this->isKeepQuery() ? clone $this : $this; $stmt = $criteria->filterByPrimaryKey($key)->getSelectStatement($con); return $criteria->getFormatter()->init($criteria)->formatOne($stmt); } }
/** * Retrieve object using using composite pkey values. * @param int $from_own_node_id * @param int $to_own_node_id * @param PropelPDO $con * @return MeshingTrustLocal */ public static function retrieveByPK($from_own_node_id, $to_own_node_id, PropelPDO $con = null) { $_instancePoolKey = serialize(array((string) $from_own_node_id, (string) $to_own_node_id)); if (null !== ($obj = MeshingTrustLocalPeer::getInstanceFromPool($_instancePoolKey))) { return $obj; } if ($con === null) { $con = Propel::getConnection(MeshingTrustLocalPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $criteria = new Criteria(MeshingTrustLocalPeer::DATABASE_NAME); $criteria->add(MeshingTrustLocalPeer::FROM_OWN_NODE_ID, $from_own_node_id); $criteria->add(MeshingTrustLocalPeer::TO_OWN_NODE_ID, $to_own_node_id); $v = MeshingTrustLocalPeer::doSelect($criteria, $con); return !empty($v) ? $v[0] : null; }