Пример #1
0
 /**
  * Writes the connection record
  * 
  * @todo Need to validate string lengths etc (or catch exceptions properly)
  */
 protected function writeRecord()
 {
     $connection = new P2PConnection();
     $connection->setName($this->opts->name);
     $connection->setAdaptor($this->opts->adaptor);
     $connection->setHost($this->opts->host);
     if ($this->opts->database) {
         $connection->setDatabase($this->opts->database);
     }
     if ($this->opts->user) {
         $connection->setUsername($this->opts->user);
     }
     if ($this->opts->password) {
         $connection->setPassword($this->opts->password);
     }
     $connection->save();
 }
Пример #2
0
 /**
  * Declares an association between this object and a P2PConnection object.
  *
  * @param      P2PConnection $v
  * @return     P2POwnNode The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setP2PConnection(P2PConnection $v = null)
 {
     if ($v === null) {
         $this->setConnectionId(NULL);
     } else {
         $this->setConnectionId($v->getId());
     }
     $this->aP2PConnection = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the P2PConnection object, it will not be re-added.
     if ($v !== null) {
         $v->addP2POwnNode($this);
     }
     return $this;
 }
Пример #3
0
 /**
  * Exclude object from result
  *
  * @param     P2PConnection $p2PConnection Object to remove from the list of results
  *
  * @return    P2PConnectionQuery The current query, for fluid interface
  */
 public function prune($p2PConnection = null)
 {
     if ($p2PConnection) {
         $this->addUsingAlias(P2PConnectionPeer::ID, $p2PConnection->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
Пример #4
0
 /**
  * Filter the query by a related P2PConnection object
  *
  * @param     P2PConnection|PropelCollection $p2PConnection The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return    P2POwnNodeQuery The current query, for fluid interface
  */
 public function filterByP2PConnection($p2PConnection, $comparison = null)
 {
     if ($p2PConnection instanceof P2PConnection) {
         return $this->addUsingAlias(P2POwnNodePeer::CONNECTION_ID, $p2PConnection->getId(), $comparison);
     } elseif ($p2PConnection instanceof PropelCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(P2POwnNodePeer::CONNECTION_ID, $p2PConnection->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByP2PConnection() only accepts arguments of type P2PConnection or PropelCollection');
     }
 }