array('Id', 'Fqdn', 'Fingerprint', 'PublicKey', 'Certificate', 'Location', 'Speed', 'ExternalIp', 'InternalIp', 'Netmask', 'FirstDns', 'SecondDns', 'Port', 'Protocol', 'Status', ), self::TYPE_CAMELNAME => array('id', 'fqdn', 'fingerprint', 'publicKey', 'certificate', 'location', 'speed', 'externalIp', 'internalIp', 'netmask', 'firstDns', 'secondDns', 'port', 'protocol', 'status', ), self::TYPE_COLNAME => array(ServerTableMap::COL_ID, ServerTableMap::COL_FQDN, ServerTableMap::COL_FINGERPRINT, ServerTableMap::COL_PUBLIC_KEY, ServerTableMap::COL_CERTIFICATE, ServerTableMap::COL_LOCATION, ServerTableMap::COL_SPEED, ServerTableMap::COL_EXTERNAL_IP, ServerTableMap::COL_INTERNAL_IP, ServerTableMap::COL_NETMASK, ServerTableMap::COL_FIRST_DNS, ServerTableMap::COL_SECOND_DNS, ServerTableMap::COL_PORT, ServerTableMap::COL_PROTOCOL, ServerTableMap::COL_STATUS, ), self::TYPE_FIELDNAME => array('id', 'fqdn', 'fingerprint', 'public_key', 'certificate', 'location', 'speed', 'external_ip', 'internal_ip', 'netmask', 'first_dns', 'second_dns', 'port', 'protocol', 'status', ), self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ) ); /** * holds an array of keys for quick access to the fieldnames array * * first dimension keys are the type constants * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( self::TYPE_PHPNAME => array('Id' => 0, 'Fqdn' => 1, 'Fingerprint' => 2, 'PublicKey' => 3, 'Certificate' => 4, 'Location' => 5, 'Speed' => 6, 'ExternalIp' => 7, 'InternalIp' => 8, 'Netmask' => 9, 'FirstDns' => 10, 'SecondDns' => 11, 'Port' => 12, 'Protocol' => 13, 'Status' => 14, ), self::TYPE_CAMELNAME => array('id' => 0, 'fqdn' => 1, 'fingerprint' => 2, 'publicKey' => 3, 'certificate' => 4, 'location' => 5, 'speed' => 6, 'externalIp' => 7, 'internalIp' => 8, 'netmask' => 9, 'firstDns' => 10, 'secondDns' => 11, 'port' => 12, 'protocol' => 13, 'status' => 14, ), self::TYPE_COLNAME => array(ServerTableMap::COL_ID => 0, ServerTableMap::COL_FQDN => 1, ServerTableMap::COL_FINGERPRINT => 2, ServerTableMap::COL_PUBLIC_KEY => 3, ServerTableMap::COL_CERTIFICATE => 4, ServerTableMap::COL_LOCATION => 5, ServerTableMap::COL_SPEED => 6, ServerTableMap::COL_EXTERNAL_IP => 7, ServerTableMap::COL_INTERNAL_IP => 8, ServerTableMap::COL_NETMASK => 9, ServerTableMap::COL_FIRST_DNS => 10, ServerTableMap::COL_SECOND_DNS => 11, ServerTableMap::COL_PORT => 12, ServerTableMap::COL_PROTOCOL => 13, ServerTableMap::COL_STATUS => 14, ), self::TYPE_FIELDNAME => array('id' => 0, 'fqdn' => 1, 'fingerprint' => 2, 'public_key' => 3, 'certificate' => 4, 'location' => 5, 'speed' => 6, 'external_ip' => 7, 'internal_ip' => 8, 'netmask' => 9, 'first_dns' => 10, 'second_dns' => 11, 'port' => 12, 'protocol' => 13, 'status' => 14, ), self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ) ); /** The enumerated values for this table */ protected static $enumValueSets = array( ServerTableMap::COL_PROTOCOL => array( self::COL_PROTOCOL_UDP, self::COL_PROTOCOL_TCP, ), ServerTableMap::COL_STATUS => array( self::COL_STATUS_REGISTERED, self::COL_STATUS_SIGNED, self::COL_STATUS_REVOKED, ), ); /** * Gets the list of values for all ENUM columns * @return array */ public static function getValueSets() { return static::$enumValueSets; } /** * Gets the list of values for an ENUM column * @param string $colname * @return array list of possible values for the column */ public static function getValueSet($colname) { $valueSets = self::getValueSets(); return $valueSets[$colname]; } /** * Initialize the table attributes and columns * Relations are not initialized by this method since they are lazy loaded * * @return void * @throws PropelException */ public function initialize() { // attributes $this->setName('Server'); $this->setPhpName('Server'); $this->setIdentifierQuoting(false); $this->setClassName('\\Eater\\Glim\\Model\\Server'); $this->setPackage(''); $this->setUseIdGenerator(true); // columns $this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null); $this->addColumn('fqdn', 'Fqdn', 'VARCHAR', false, 64, null); $this->addColumn('fingerprint', 'Fingerprint', 'VARCHAR', false, 64, null); $this->addColumn('public_key', 'PublicKey', 'LONGVARCHAR', false, null, null); $this->addColumn('certificate', 'Certificate', 'LONGVARCHAR', false, null, null); $this->addColumn('location', 'Location', 'VARCHAR', false, 64, 'Unknown'); $this->addColumn('speed', 'Speed', 'INTEGER', false, null, -1); $this->addColumn('external_ip', 'ExternalIp', 'VARCHAR', false, 128, null); $this->addColumn('internal_ip', 'InternalIp', 'VARCHAR', false, 128, '10.24.0.0'); $this->addColumn('netmask', 'Netmask', 'INTEGER', false, 4, 16); $this->addColumn('first_dns', 'FirstDns', 'VARCHAR', false, 128, null); $this->addColumn('second_dns', 'SecondDns', 'VARCHAR', false, 128, null); $this->addColumn('port', 'Port', 'INTEGER', false, null, 1194); $this->addColumn('protocol', 'Protocol', 'ENUM', false, null, 'udp'); $this->getColumn('protocol')->setValueSet(array ( 0 => 'udp', 1 => 'tcp', )); $this->addColumn('status', 'Status', 'ENUM', false, null, 'registered'); $this->getColumn('status')->setValueSet(array ( 0 => 'registered', 1 => 'signed', 2 => 'revoked', )); } // initialize() /** * Build the RelationMap objects for this table relationships */ public function buildRelations() { } // buildRelations() /** * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. * * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, a serialize()d version of the primary key will be returned. * * @param array $row resultset row. * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * * @return string The primary key hash of the row */ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) { // If the PK cannot be derived from the row, return NULL. if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { return null; } return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; } /** * Retrieves the primary key from the DB resultset row * For tables with a single-column primary key, that simple pkey value will be returned. For tables with * a multi-column primary key, an array of the primary key columns will be returned. * * @param array $row resultset row. * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM * * @return mixed The primary key of the row */ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) { return (int) $row[ $indexType == TableMap::TYPE_NUM ? 0 + $offset : self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType) ]; } /** * The class that the tableMap will make instances of. * * If $withPrefix is true, the returned path * uses a dot-path notation which is translated into a path * relative to a location on the PHP include_path. * (e.g. path.to.MyClass -> 'path/to/MyClass.php') * * @param boolean $withPrefix Whether or not to return the path with the class name * @return string path.to.ClassName */ public static function getOMClass($withPrefix = true) { return $withPrefix ? ServerTableMap::CLASS_DEFAULT : ServerTableMap::OM_CLASS; } /** * Populates an object of the default type or an object that inherit from the default. * * @param array $row row returned by DataFetcher->fetch(). * @param int $offset The 0-based offset for reading from the resultset row. * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. * @return array (Server object, last column rank) */ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) { $key = ServerTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); if (null !== ($obj = ServerTableMap::getInstanceFromPool($key))) { // We no longer rehydrate the object, since this can cause data loss. // See http://www.propelorm.org/ticket/509 // $obj->hydrate($row, $offset, true); // rehydrate $col = $offset + ServerTableMap::NUM_HYDRATE_COLUMNS; } else { $cls = ServerTableMap::OM_CLASS; /** @var Server $obj */ $obj = new $cls(); $col = $obj->hydrate($row, $offset, false, $indexType); ServerTableMap::addInstanceToPool($obj, $key); } return array($obj, $col); } /** * The returned array will contain objects of the default type or * objects that inherit from the default. * * @param DataFetcherInterface $dataFetcher * @return array * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function populateObjects(DataFetcherInterface $dataFetcher) { $results = array(); // set the class once to avoid overhead in the loop $cls = static::getOMClass(false); // populate the object(s) while ($row = $dataFetcher->fetch()) { $key = ServerTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); if (null !== ($obj = ServerTableMap::getInstanceFromPool($key))) { // We no longer rehydrate the object, since this can cause data loss. // See http://www.propelorm.org/ticket/509 // $obj->hydrate($row, 0, true); // rehydrate $results[] = $obj; } else { /** @var Server $obj */ $obj = new $cls(); $obj->hydrate($row); $results[] = $obj; ServerTableMap::addInstanceToPool($obj, $key); } // if key exists } return $results; } /** * Add all the columns needed to create a new object. * * Note: any columns that were marked with lazyLoad="true" in the * XML schema will not be added to the select list and only loaded * on demand. * * @param Criteria $criteria object containing the columns to add. * @param string $alias optional table alias * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function addSelectColumns(Criteria $criteria, $alias = null) { if (null === $alias) { $criteria->addSelectColumn(ServerTableMap::COL_ID); $criteria->addSelectColumn(ServerTableMap::COL_FQDN); $criteria->addSelectColumn(ServerTableMap::COL_FINGERPRINT); $criteria->addSelectColumn(ServerTableMap::COL_PUBLIC_KEY); $criteria->addSelectColumn(ServerTableMap::COL_CERTIFICATE); $criteria->addSelectColumn(ServerTableMap::COL_LOCATION); $criteria->addSelectColumn(ServerTableMap::COL_SPEED); $criteria->addSelectColumn(ServerTableMap::COL_EXTERNAL_IP); $criteria->addSelectColumn(ServerTableMap::COL_INTERNAL_IP); $criteria->addSelectColumn(ServerTableMap::COL_NETMASK); $criteria->addSelectColumn(ServerTableMap::COL_FIRST_DNS); $criteria->addSelectColumn(ServerTableMap::COL_SECOND_DNS); $criteria->addSelectColumn(ServerTableMap::COL_PORT); $criteria->addSelectColumn(ServerTableMap::COL_PROTOCOL); $criteria->addSelectColumn(ServerTableMap::COL_STATUS); } else { $criteria->addSelectColumn($alias . '.id'); $criteria->addSelectColumn($alias . '.fqdn'); $criteria->addSelectColumn($alias . '.fingerprint'); $criteria->addSelectColumn($alias . '.public_key'); $criteria->addSelectColumn($alias . '.certificate'); $criteria->addSelectColumn($alias . '.location'); $criteria->addSelectColumn($alias . '.speed'); $criteria->addSelectColumn($alias . '.external_ip'); $criteria->addSelectColumn($alias . '.internal_ip'); $criteria->addSelectColumn($alias . '.netmask'); $criteria->addSelectColumn($alias . '.first_dns'); $criteria->addSelectColumn($alias . '.second_dns'); $criteria->addSelectColumn($alias . '.port'); $criteria->addSelectColumn($alias . '.protocol'); $criteria->addSelectColumn($alias . '.status'); } } /** * Returns the TableMap related to this object. * This method is not needed for general use but a specific application could have a need. * @return TableMap * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function getTableMap() { return Propel::getServiceContainer()->getDatabaseMap(ServerTableMap::DATABASE_NAME)->getTable(ServerTableMap::TABLE_NAME); } /** * Add a TableMap instance to the database for this tableMap class. */ public static function buildTableMap() { $dbMap = Propel::getServiceContainer()->getDatabaseMap(ServerTableMap::DATABASE_NAME); if (!$dbMap->hasTable(ServerTableMap::TABLE_NAME)) { $dbMap->addTableObject(new ServerTableMap()); } } /** * Performs a DELETE on the database, given a Server or Criteria object OR a primary key value. * * @param mixed $values Criteria or Server object or primary key or array of primary keys * which is used to create the DELETE statement * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doDelete($values, ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(ServerTableMap::DATABASE_NAME); } if ($values instanceof Criteria) { // rename for clarity $criteria = $values; } elseif ($values instanceof \Eater\Glim\Model\Server) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); } else { // it's a primary key, or an array of pks $criteria = new Criteria(ServerTableMap::DATABASE_NAME); $criteria->add(ServerTableMap::COL_ID, (array) $values, Criteria::IN); } $query = ServerQuery::create()->mergeWith($criteria); if ($values instanceof Criteria) { ServerTableMap::clearInstancePool(); } elseif (!is_object($values)) { // it's a primary key, or an array of pks foreach ((array) $values as $singleval) { ServerTableMap::removeInstanceFromPool($singleval); } } return $query->delete($con); } /** * Deletes all rows from the Server table. * * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ public static function doDeleteAll(ConnectionInterface $con = null) { return ServerQuery::create()->doDeleteAll($con); } /** * Performs an INSERT on the database, given a Server or Criteria object. * * @param mixed $criteria Criteria or Server object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use * @return mixed The new primary key. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doInsert($criteria, ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(ServerTableMap::DATABASE_NAME); } if ($criteria instanceof Criteria) { $criteria = clone $criteria; // rename for clarity } else { $criteria = $criteria->buildCriteria(); // build Criteria from Server object } if ($criteria->containsKey(ServerTableMap::COL_ID) && $criteria->keyContainsValue(ServerTableMap::COL_ID) ) { throw new PropelException('Cannot insert a value for auto-increment primary key ('.ServerTableMap::COL_ID.')'); } // Set the correct dbName $query = ServerQuery::create()->mergeWith($criteria); // use transaction because $criteria could contain info // for more than one table (I guess, conceivably) return $con->transaction(function () use ($con, $query) { return $query->doInsert($con); }); } } // ServerTableMap // This is the static code needed to register the TableMap for this table with the main Propel class. // ServerTableMap::buildTableMap();