idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
3,700
public function addIndex ( $ idxdata ) { if ( $ idxdata instanceof Index ) { $ index = $ idxdata ; $ index -> setTable ( $ this ) ; $ index -> getName ( ) ; $ this -> indices [ ] = $ index ; return $ index ; } else { $ index = new Index ( $ this ) ; $ index -> loadFromXML ( $ idxdata ) ; return $ this -> addIndex ( $ i...
Adds a new index to the index list and set the parent table of the column to the current table
3,701
public function addUnique ( $ unqdata ) { if ( $ unqdata instanceof Unique ) { $ unique = $ unqdata ; $ unique -> setTable ( $ this ) ; $ unique -> getName ( ) ; $ this -> unices [ ] = $ unique ; return $ unique ; } else { $ unique = new Unique ( $ this ) ; $ unique -> loadFromXML ( $ unqdata ) ; return $ this -> addUn...
Adds a new Unique to the Unique list and set the parent table of the column to the current table
3,702
public function getEarlyBehaviors ( ) { $ behaviors = array ( ) ; foreach ( $ this -> behaviors as $ name => $ behavior ) { if ( $ behavior -> isEarly ( ) ) { $ behaviors [ $ name ] = $ behavior ; } } return $ behaviors ; }
Get the early table behaviors
3,703
public function getAdditionalBuilders ( ) { $ additionalBuilders = array ( ) ; foreach ( $ this -> getBehaviors ( ) as $ behavior ) { $ additionalBuilders = array_merge ( $ additionalBuilders , $ behavior -> getAdditionalBuilders ( ) ) ; } return $ additionalBuilders ; }
Get the additional builders provided by the table behaviors
3,704
public function getName ( ) { if ( $ this -> schema && $ this -> getDatabase ( ) && $ this -> getDatabase ( ) -> getPlatform ( ) && $ this -> getDatabase ( ) -> getPlatform ( ) -> supportsSchemas ( ) ) { return $ this -> schema . '.' . $ this -> commonName ; } else { return $ this -> commonName ; } }
Get the name of the Table
3,705
public function getPhpName ( ) { if ( $ this -> phpName === null ) { $ inputs = array ( ) ; $ inputs [ ] = $ this -> getStdSeparatedName ( ) ; $ inputs [ ] = $ this -> phpNamingMethod ; try { $ this -> phpName = NameFactory :: generateName ( NameFactory :: PHP_GENERATOR , $ inputs ) ; } catch ( EngineException $ e ) { ...
Get name to use in PHP sources
3,706
public function getDefaultStringFormat ( ) { if ( ! $ this -> defaultStringFormat && $ this -> getDatabase ( ) && $ this -> getDatabase ( ) -> getDefaultStringFormat ( ) ) { return $ this -> getDatabase ( ) -> getDefaultStringFormat ( ) ; } return $ this -> defaultStringFormat ; }
Get the default string format for ActiveRecord objects in this Table or the one for the whole database if not set .
3,707
public function getNumLazyLoadColumns ( ) { $ count = 0 ; foreach ( $ this -> columnList as $ col ) { if ( $ col -> isLazyLoad ( ) ) { $ count ++ ; } } return $ count ; }
Utility method to get the number of columns in this table
3,708
public function hasEnumColumns ( ) { foreach ( $ this -> getColumns ( ) as $ col ) { if ( $ col -> isEnumType ( ) || $ col -> getValueSet ( ) ) { return true ; } } return false ; }
Checks whether one of the columns is of type ENUM
3,709
public function hasColumn ( $ col , $ caseInsensitive = false ) { if ( $ col instanceof Column ) { $ col = $ col -> getName ( ) ; } if ( $ caseInsensitive ) { return array_key_exists ( strtolower ( $ col ) , $ this -> columnsByLowercaseName ) ; } else { return array_key_exists ( $ col , $ this -> columnsByName ) ; } }
Check whether the table has a column .
3,710
public function getForeignKeysReferencingTable ( $ tablename ) { $ matches = array ( ) ; $ keys = $ this -> getForeignKeys ( ) ; foreach ( $ keys as $ fk ) { if ( $ fk -> getForeignTableName ( ) === $ tablename ) { $ matches [ ] = $ fk ; } } return $ matches ; }
Get all the foreign keys from this table to the specified table .
3,711
public function getAutoIncrementPrimaryKey ( ) { if ( $ this -> getIdMethod ( ) != IDMethod :: NO_ID_METHOD ) { $ pks = $ this -> getPrimaryKey ( ) ; foreach ( $ pks as $ pk ) { if ( $ pk -> isAutoIncrement ( ) ) { return $ pk ; } } } return null ; }
Gets the auto increment PK
3,712
private function printList ( $ list ) { $ result = "" ; $ comma = 0 ; for ( $ i = 0 , $ _i = count ( $ list ) ; $ i < $ _i ; $ i ++ ) { $ col = $ list [ $ i ] ; if ( $ col -> isPrimaryKey ( ) ) { $ result .= ( $ comma ++ ? ',' : '' ) . $ this -> getDatabase ( ) -> getPlatform ( ) -> quoteIdentifier ( $ col -> getName (...
Returns the elements of the list separated by commas .
3,713
public function copy ( Domain $ domain ) { $ this -> defaultValue = $ domain -> getDefaultValue ( ) ; $ this -> description = $ domain -> getDescription ( ) ; $ this -> name = $ domain -> getName ( ) ; $ this -> scale = $ domain -> getScale ( ) ; $ this -> size = $ domain -> getSize ( ) ; $ this -> sqlType = $ domain -...
Copy the values from current object into passed - in Domain .
3,714
public function getPhpDefaultValue ( ) { if ( $ this -> defaultValue === null ) { return null ; } if ( $ this -> defaultValue -> isExpression ( ) ) { throw new EngineException ( "Cannot get PHP version of default value for default value EXPRESSION." ) ; } if ( $ this -> propelType === PropelTypes :: BOOLEAN || $ this -...
Gets the default value type - casted for use in PHP OM .
3,715
public function printSize ( ) { if ( $ this -> size !== null && $ this -> scale !== null ) { return '(' . $ this -> size . ',' . $ this -> scale . ')' ; } elseif ( $ this -> size !== null ) { return '(' . $ this -> size . ')' ; } else { return "" ; } }
Return the size and scale in brackets for use in an sql schema .
3,716
public static function load ( $ value ) { $ value = trim ( $ value ) ; if ( 0 == strlen ( $ value ) ) { return '' ; } if ( function_exists ( 'mb_internal_encoding' ) && ( ( int ) ini_get ( 'mbstring.func_overload' ) ) & 2 ) { $ mbEncoding = mb_internal_encoding ( ) ; mb_internal_encoding ( 'ASCII' ) ; } switch ( $ valu...
Convert a YAML string to a PHP array .
3,717
protected static function parseQuotedScalar ( $ scalar , & $ i ) { if ( ! preg_match ( '/' . self :: REGEX_QUOTED_STRING . '/Au' , substr ( $ scalar , $ i ) , $ match ) ) { throw new InvalidArgumentException ( sprintf ( 'Malformed inline YAML string (%s).' , substr ( $ scalar , $ i ) ) ) ; } $ output = substr ( $ match...
Parses a quoted scalar to YAML .
3,718
protected static function parseSequence ( $ sequence , & $ i = 0 ) { $ output = array ( ) ; $ len = strlen ( $ sequence ) ; $ i += 1 ; while ( $ i < $ len ) { switch ( $ sequence [ $ i ] ) { case '[' : $ output [ ] = self :: parseSequence ( $ sequence , $ i ) ; break ; case '{' : $ output [ ] = self :: parseMapping ( $...
Parses a sequence to a YAML string .
3,719
public function getClass ( ) { if ( $ this -> classname === null && $ this -> name !== null ) { return "propel.validator." . ucfirst ( $ this -> name ) . "Validator" ; } return $ this -> classname ; }
Gets the dot - path name of class to use for rule . If no class was specified this method will build a default classname based on the name attribute . E . g . maxLength - > propel . validator . MaxLengthValidator
3,720
protected function getRootNode ( $ rootElementName = 'data' ) { $ xml = new DOMDocument ( '1.0' , 'UTF-8' ) ; $ xml -> preserveWhiteSpace = false ; $ xml -> formatOutput = true ; $ rootElement = $ xml -> createElement ( $ rootElementName ) ; $ xml -> appendChild ( $ rootElement ) ; return $ rootElement ; }
Create a DOMDocument and get the root DOMNode using a root element name
3,721
protected function createSqlDbMap ( ) { if ( $ this -> getSqlDbMap ( ) === null ) { return ; } $ sqldbmap = new Properties ( ) ; if ( $ this -> getSqlDbMap ( ) -> exists ( ) ) { $ sqldbmap -> load ( $ this -> getSqlDbMap ( ) ) ; } if ( $ this -> packageObjectModel ) { $ dataModels = $ this -> packageDataModels ( ) ; fo...
Create the sql - > database map .
3,722
protected function packageDataModels ( ) { static $ packagedDataModels ; if ( is_null ( $ packagedDataModels ) ) { $ dataModels = $ this -> getDataModels ( ) ; $ dataModel = array_shift ( $ dataModels ) ; $ packagedDataModels = array ( ) ; $ platform = $ this -> getGeneratorConfig ( ) -> getConfiguredPlatform ( ) ; for...
Packages the datamodels to one datamodel per package
3,723
public function normalizeFKey ( $ attrib ) { if ( $ attrib === null || strtoupper ( $ attrib ) == "NONE" ) { $ attrib = self :: NONE ; } $ attrib = strtoupper ( $ attrib ) ; if ( $ attrib == "SETNULL" ) { $ attrib = self :: SETNULL ; } return $ attrib ; }
normalizes the input of onDelete onUpdate attributes
3,724
public function hasOnUpdate ( ) { $ database = $ this -> getTable ( ) -> getDatabase ( ) ; if ( $ database instanceof Database && $ this -> onUpdate === $ database -> getPlatform ( ) -> getDefaultFKOnUpdateBehavior ( ) ) { return false ; } return ( $ this -> onUpdate !== self :: NONE ) ; }
returns whether or not the onUpdate attribute is set
3,725
public function hasOnDelete ( ) { $ database = $ this -> getTable ( ) -> getDatabase ( ) ; if ( $ database instanceof Database && $ this -> onDelete === $ database -> getPlatform ( ) -> getDefaultFKOnDeleteBehavior ( ) ) { return false ; } return ( $ this -> onDelete !== self :: NONE ) ; }
returns whether or not the onDelete attribute is set
3,726
public function getForeignTableName ( ) { if ( $ this -> foreignSchemaName && $ this -> getTable ( ) -> getDatabase ( ) -> getPlatform ( ) -> supportsSchemas ( ) ) { return $ this -> foreignSchemaName . '.' . $ this -> foreignTableCommonName ; } else { return $ this -> foreignTableCommonName ; } }
Get the foreignTableName of the FK
3,727
public function getLocalColumnObjects ( ) { $ columns = array ( ) ; $ localTable = $ this -> getTable ( ) ; foreach ( $ this -> localColumns as $ columnName ) { $ columns [ ] = $ localTable -> getColumn ( $ columnName ) ; } return $ columns ; }
Return an array of local column objects .
3,728
public function getColumnObjectsMapping ( ) { $ mapping = array ( ) ; $ localTable = $ this -> getTable ( ) ; $ foreignTable = $ this -> getForeignTable ( ) ; for ( $ i = 0 , $ size = count ( $ this -> localColumns ) ; $ i < $ size ; $ i ++ ) { $ mapping [ ] = array ( 'local' => $ localTable -> getColumn ( $ this -> lo...
Utility method to get local and foreign column objects mapping for this foreign key .
3,729
public function getMappedForeignColumn ( $ local ) { $ m = $ this -> getLocalForeignMapping ( ) ; if ( isset ( $ m [ $ local ] ) ) { return $ m [ $ local ] ; } return null ; }
Get the foreign column mapped to specified local column .
3,730
public function getMappedLocalColumn ( $ foreign ) { $ m = $ this -> getForeignLocalMapping ( ) ; if ( isset ( $ m [ $ foreign ] ) ) { return $ m [ $ foreign ] ; } return null ; }
Get the local column mapped to specified foreign column .
3,731
public function isLocalColumnsRequired ( ) { foreach ( $ this -> getLocalColumns ( ) as $ columnName ) { if ( ! $ this -> getTable ( ) -> getColumn ( $ columnName ) -> isNotNull ( ) ) { return false ; } } return true ; }
Whether this foreign key uses a required column or a list of required columns .
3,732
public function isForeignPrimaryKey ( ) { $ lfmap = $ this -> getLocalForeignMapping ( ) ; $ foreignTable = $ this -> getForeignTable ( ) ; $ foreignPKCols = array ( ) ; foreach ( $ foreignTable -> getPrimaryKey ( ) as $ fPKCol ) { $ foreignPKCols [ ] = $ fPKCol -> getName ( ) ; } $ foreignCols = array ( ) ; foreach ( ...
Whether this foreign key is also the primary key of the foreign table .
3,733
public function isLocalPrimaryKey ( ) { $ localCols = $ this -> getLocalColumns ( ) ; $ localPKColumnObjs = $ this -> getTable ( ) -> getPrimaryKey ( ) ; $ localPKCols = array ( ) ; foreach ( $ localPKColumnObjs as $ lPKCol ) { $ localPKCols [ ] = $ lPKCol -> getName ( ) ; } return ( ( count ( $ localPKCols ) === count...
Whether this foreign key is also the primary key of the local table .
3,734
public function isAtLeastOneLocalPrimaryKey ( ) { $ localCols = $ this -> getLocalColumnObjects ( ) ; foreach ( $ localCols as $ localCol ) { if ( $ this -> getTable ( ) -> getColumn ( $ localCol -> getName ( ) ) -> isPrimaryKey ( ) ) { return true ; } } return false ; }
Whether at least one local column is also a primary key .
3,735
public function getOtherFks ( ) { $ fks = array ( ) ; foreach ( $ this -> getTable ( ) -> getForeignKeys ( ) as $ fk ) { if ( $ fk !== $ this ) { $ fks [ ] = $ fk ; } } return $ fks ; }
Get the other foreign keys starting on the same table Used in many - to - many relationships
3,736
public function hasColumn ( $ name , $ normalize = true ) { if ( $ name instanceof ColumnMap ) { $ name = $ name -> getColumnName ( ) ; } elseif ( $ normalize ) { $ name = ColumnMap :: normalizeName ( $ name ) ; } return isset ( $ this -> columns [ $ name ] ) ; }
Does this table contain the specified column?
3,737
public function addValidator ( $ columnName , $ name , $ classname , $ value , $ message ) { if ( false !== ( $ pos = strpos ( $ columnName , '.' ) ) ) { $ columnName = substr ( $ columnName , $ pos + 1 ) ; } $ col = $ this -> getColumn ( $ columnName ) ; if ( $ col !== null ) { $ validator = new ValidatorMap ( $ col )...
Add a validator to a table s column
3,738
public function getRelation ( $ name ) { if ( ! array_key_exists ( $ name , $ this -> getRelations ( ) ) ) { throw new PropelException ( 'Calling getRelation() on an unknown relation, ' . $ name ) ; } return $ this -> relations [ $ name ] ; }
Gets a RelationMap of the table by relation name This method will build the relations if they are not built yet
3,739
protected function removePrefix ( $ data ) { return $ this -> hasPrefix ( $ data ) ? substr ( $ data , strlen ( $ this -> prefix ) ) : $ data ; }
Removes the PREFIX if found
3,740
final public function removeUnderScores ( $ data ) { $ out = '' ; $ tmp = $ this -> removePrefix ( $ data ) ; $ tok = strtok ( $ tmp , '_' ) ; while ( $ tok ) { $ out .= ucfirst ( $ tok ) ; $ tok = strtok ( '_' ) ; } return $ out ; }
Removes the PREFIX removes the underscores and makes first letter caps .
3,741
public function getPeerBuilder ( ) { if ( ! isset ( $ this -> peerBuilder ) ) { $ this -> peerBuilder = $ this -> getGeneratorConfig ( ) -> getConfiguredBuilder ( $ this -> getTable ( ) , 'peer' ) ; } return $ this -> peerBuilder ; }
Returns new or existing Peer builder class for this table .
3,742
public function getStubPeerBuilder ( ) { if ( ! isset ( $ this -> stubPeerBuilder ) ) { $ this -> stubPeerBuilder = $ this -> getGeneratorConfig ( ) -> getConfiguredBuilder ( $ this -> getTable ( ) , 'peerstub' ) ; } return $ this -> stubPeerBuilder ; }
Returns new or existing stub Peer builder class for this table .
3,743
public function getNodeBuilder ( ) { if ( ! isset ( $ this -> nodeBuilder ) ) { $ this -> nodeBuilder = $ this -> getGeneratorConfig ( ) -> getConfiguredBuilder ( $ this -> getTable ( ) , 'node' ) ; } return $ this -> nodeBuilder ; }
Returns new or existing node Object builder class for this table .
3,744
public function getNodePeerBuilder ( ) { if ( ! isset ( $ this -> nodePeerBuilder ) ) { $ this -> nodePeerBuilder = $ this -> getGeneratorConfig ( ) -> getConfiguredBuilder ( $ this -> getTable ( ) , 'nodepeer' ) ; } return $ this -> nodePeerBuilder ; }
Returns new or existing node Peer builder class for this table .
3,745
public function getStubNodeBuilder ( ) { if ( ! isset ( $ this -> stubNodeBuilder ) ) { $ this -> stubNodeBuilder = $ this -> getGeneratorConfig ( ) -> getConfiguredBuilder ( $ this -> getTable ( ) , 'nodestub' ) ; } return $ this -> stubNodeBuilder ; }
Returns new or existing stub node Object builder class for this table .
3,746
public function getStubNodePeerBuilder ( ) { if ( ! isset ( $ this -> stubNodePeerBuilder ) ) { $ this -> stubNodePeerBuilder = $ this -> getGeneratorConfig ( ) -> getConfiguredBuilder ( $ this -> getTable ( ) , 'nodepeerstub' ) ; } return $ this -> stubNodePeerBuilder ; }
Returns new or existing stub node Peer builder class for this table .
3,747
public function getNestedSetBuilder ( ) { if ( ! isset ( $ this -> nestedSetBuilder ) ) { $ this -> nestedSetBuilder = $ this -> getGeneratorConfig ( ) -> getConfiguredBuilder ( $ this -> getTable ( ) , 'nestedset' ) ; } return $ this -> nestedSetBuilder ; }
Returns new or existing nested set object builder class for this table .
3,748
public function getNestedSetPeerBuilder ( ) { if ( ! isset ( $ this -> nestedSetPeerBuilder ) ) { $ this -> nestedSetPeerBuilder = $ this -> getGeneratorConfig ( ) -> getConfiguredBuilder ( $ this -> getTable ( ) , 'nestedsetpeer' ) ; } return $ this -> nestedSetPeerBuilder ; }
Returns new or existing nested set Peer builder class for this table .
3,749
public function getDataSQLBuilder ( ) { if ( ! isset ( $ this -> dataSqlBuilder ) ) { $ this -> dataSqlBuilder = $ this -> getGeneratorConfig ( ) -> getConfiguredBuilder ( $ this -> getTable ( ) , 'datasql' ) ; } return $ this -> dataSqlBuilder ; }
Returns new or existing data sql builder class for this table .
3,750
public function getNewQueryInheritanceBuilder ( $ child ) { $ queryInheritanceBuilder = $ this -> getGeneratorConfig ( ) -> getConfiguredBuilder ( $ this -> getTable ( ) , 'queryinheritance' ) ; $ queryInheritanceBuilder -> setChild ( $ child ) ; return $ queryInheritanceBuilder ; }
Returns new Query Inheritance builder class for this table .
3,751
protected function getWorkerObject ( $ col , $ class ) { $ key = $ col . '_' . $ class ; if ( isset ( $ this -> currentObjects [ $ key ] ) ) { $ this -> currentObjects [ $ key ] -> clear ( ) ; } else { $ this -> currentObjects [ $ key ] = new $ class ( ) ; } return $ this -> currentObjects [ $ key ] ; }
Gets the worker object for the class . To save memory we don t create a new object for each row But we keep hydrating a single object per class . The column offset in the row is used to index the array of classes As there may be more than one object of the same class in the chain
3,752
public function getChangeColumnDDL ( $ fromColumn , $ toColumn ) { $ pattern = "ALTER TABLE %s CHANGE %s %s;" ; return sprintf ( $ pattern , $ this -> quoteIdentifier ( $ fromColumn -> getTable ( ) -> getName ( ) ) , $ this -> quoteIdentifier ( $ fromColumn -> getName ( ) ) , $ this -> getColumnDDL ( $ toColumn ) ) ; }
Builds the DDL SQL to change a column
3,753
public function useQuery ( $ relationName , $ secondaryCriteriaClass = null ) { if ( ! isset ( $ this -> joins [ $ relationName ] ) ) { throw new PropelException ( 'Unknown class or alias ' . $ relationName ) ; } $ className = $ this -> joins [ $ relationName ] -> getTableMap ( ) -> getPhpName ( ) ; if ( null === $ sec...
Initializes a secondary ModelCriteria object to be later merged with the current object
3,754
public function addSelfSelectColumns ( ) { call_user_func ( array ( $ this -> modelPeerName , 'addSelectColumns' ) , $ this , $ this -> useAliasInSQL ? $ this -> modelAlias : null ) ; return $ this ; }
Adds the select columns for a the current table
3,755
public function find ( $ con = null ) { if ( $ con === null ) { $ con = Propel :: getConnection ( $ this -> getDbName ( ) , Propel :: CONNECTION_READ ) ; } $ this -> basePreSelect ( $ con ) ; $ criteria = $ this -> isKeepQuery ( ) ? clone $ this : $ this ; $ stmt = $ criteria -> doSelect ( $ con ) ; return $ criteria -...
Issue a SELECT query based on the current ModelCriteria and format the list of results with the current formatter By default returns an array of model objects
3,756
public function findBy ( $ column , $ value , $ con = null ) { $ method = 'filterBy' . $ column ; $ this -> $ method ( $ value ) ; return $ this -> find ( $ con ) ; }
Apply a condition on a column and issues the SELECT query
3,757
public function explain ( $ con = null ) { if ( $ con === null ) { $ con = Propel :: getConnection ( $ this -> getDbName ( ) ) ; } $ this -> basePreSelect ( $ con ) ; if ( ! $ this -> hasSelectClause ( ) && ! $ this -> getPrimaryCriteria ( ) ) { $ this -> addSelfSelectColumns ( ) ; } $ this -> configureSelectColumns ( ...
Make explain plan of the query
3,758
public function countTables ( ) { $ count = 0 ; foreach ( $ this -> tableList as $ table ) { if ( ! $ table -> isReadOnly ( ) ) { $ count ++ ; } } return $ count ; }
Return the number of tables in the database
3,759
public function getTable ( $ name , $ caseInsensitive = false ) { if ( $ this -> hasTable ( $ name , $ caseInsensitive ) ) { if ( $ caseInsensitive ) { return $ this -> tablesByLowercaseName [ strtolower ( $ name ) ] ; } else { return $ this -> tablesByName [ $ name ] ; } } return null ; }
Return the table with the specified name .
3,760
public function getDomain ( $ domainName ) { if ( isset ( $ this -> domainMap [ $ domainName ] ) ) { return $ this -> domainMap [ $ domainName ] ; } return null ; }
Get already configured Domain object by name .
3,761
public function addBehavior ( $ bdata ) { if ( $ bdata instanceof Behavior ) { $ behavior = $ bdata ; $ behavior -> setDatabase ( $ this ) ; $ this -> behaviors [ $ behavior -> getName ( ) ] = $ behavior ; return $ behavior ; } else { $ class = $ this -> getConfiguredBehavior ( $ bdata [ 'name' ] ) ; $ behavior = new $...
Adds a new Behavior to the database
3,762
public function getNextTableBehavior ( ) { $ behaviors = array ( ) ; foreach ( $ this -> getTables ( ) as $ table ) { foreach ( $ table -> getBehaviors ( ) as $ behavior ) { if ( ! $ behavior -> isTableModified ( ) ) { $ behaviors [ $ behavior -> getTableModificationOrder ( ) ] [ ] = $ behavior ; } } } ksort ( $ behavi...
Get the next behavior on all tables ordered by behavior priority and skipping the ones that were already executed
3,763
public function getConfiguration ( ) { if ( null === $ this -> configuration ) { $ this -> configuration = Propel :: getConfiguration ( PropelConfiguration :: TYPE_OBJECT ) ; } return $ this -> configuration ; }
Get the runtime configuration
3,764
public function getAttribute ( $ attribute ) { switch ( $ attribute ) { case self :: PROPEL_ATTR_CACHE_PREPARES : return $ this -> cachePreparedStatements ; break ; case self :: PROPEL_ATTR_CONNECTION_NAME : return $ this -> connectionName ; break ; default : return parent :: getAttribute ( $ attribute ) ; } }
Gets a connection attribute .
3,765
protected function configureStatementClass ( $ class = 'PDOStatement' , $ suppressError = true ) { if ( ! $ this -> getAttribute ( PDO :: ATTR_PERSISTENT ) ) { $ this -> setAttribute ( PDO :: ATTR_STATEMENT_CLASS , array ( $ class , array ( $ this ) ) ) ; } elseif ( ! $ suppressError ) { throw new PropelException ( 'Ex...
Configures the PDOStatement class for this connection .
3,766
public function getDebugSnapshot ( ) { if ( $ this -> useDebug ) { return array ( 'microtime' => microtime ( true ) , 'memory_get_usage' => memory_get_usage ( $ this -> getLoggingConfig ( 'realmemoryusage' , false ) ) , 'memory_get_peak_usage' => memory_get_peak_usage ( $ this -> getLoggingConfig ( 'realmemoryusage' , ...
Returns a snapshot of the current values of some functions useful in debugging .
3,767
protected function getReadableBytes ( $ bytes , $ precision ) { $ suffix = array ( 'B' , 'kB' , 'MB' , 'GB' , 'TB' , 'PB' , 'EB' , 'ZB' , 'YB' ) ; $ total = count ( $ suffix ) ; for ( $ i = 0 ; $ bytes > 1024 && $ i < $ total ; $ i ++ ) { $ bytes /= 1024 ; } return number_format ( $ bytes , $ precision ) . ' ' . $ suff...
Returns a human - readable representation of the given byte count .
3,768
public function setAddValidators ( $ v ) { $ validKeys = array_keys ( self :: $ validatorBitMap ) ; $ v = strtolower ( $ v ) ; $ bits = self :: VALIDATORS_NONE ; $ exprs = explode ( ',' , $ v ) ; foreach ( $ exprs as $ expr ) { $ expr = trim ( $ expr ) ; if ( ! empty ( $ expr ) ) { if ( ! isset ( self :: $ validatorBit...
Sets set validator bitfield from a comma - separated list of validator bit names .
3,769
protected function addValidators ( Database $ database ) { $ platform = $ this -> getGeneratorConfig ( ) -> getConfiguredPlatform ( ) ; foreach ( $ database -> getTables ( ) as $ table ) { $ set = new PropelSchemaReverse_ValidatorSet ( ) ; foreach ( $ table -> getColumns ( ) as $ col ) { if ( $ col -> isNotNull ( ) && ...
Adds any requested validators to the data model .
3,770
protected function getRuleMessage ( Column $ column , $ type , $ value ) { $ colName = $ column -> getName ( ) ; $ tableName = $ column -> getTable ( ) -> getName ( ) ; $ msg = self :: $ validatorMessages [ strtolower ( $ type ) ] ; $ tmp = compact ( $ msg [ 'var' ] ) ; array_unshift ( $ tmp , $ msg [ 'msg' ] ) ; $ msg...
Gets the message for a specified rule .
3,771
public function getValidator ( Column $ column ) { $ key = $ column -> getName ( ) ; if ( ! isset ( $ this -> validators [ $ key ] ) ) { $ this -> validators [ $ key ] = new Validator ( ) ; $ this -> validators [ $ key ] -> setColumn ( $ column ) ; } return $ this -> validators [ $ key ] ; }
Gets a single validator for specified column name .
3,772
public function addTableFromMapClass ( $ tableMapClass ) { $ table = new $ tableMapClass ( ) ; if ( ! $ this -> hasTable ( $ table -> getName ( ) ) ) { $ this -> addTableObject ( $ table ) ; return $ table ; } else { return $ this -> getTable ( $ table -> getName ( ) ) ; } }
Add a new table to the database using the tablemap class name .
3,773
public function dump ( $ data , $ path = null ) { if ( $ path !== null ) { return file_put_contents ( $ path , $ data ) ; } else { echo $ data ; } }
Dumps data to a file or to STDOUT if no filename is given
3,774
public function getConnection ( $ type = Propel :: CONNECTION_READ ) { $ databaseName = constant ( $ this -> getPeerClass ( ) . '::DATABASE_NAME' ) ; return Propel :: getConnection ( $ databaseName , $ type ) ; }
Get a connection object for the database containing the elements of the collection
3,775
protected function addRetrieveMethods ( & $ script ) { $ this -> addRetrieveNodes ( $ script ) ; $ this -> addRetrieveNodeByPK ( $ script ) ; $ this -> addRetrieveNodeByNP ( $ script ) ; $ this -> addRetrieveRootNode ( $ script ) ; }
Adds the methods for retrieving nodes .
3,776
public function addVendorInfo ( $ data ) { if ( $ data instanceof VendorInfo ) { $ vi = $ data ; $ this -> vendorInfos [ $ vi -> getType ( ) ] = $ vi ; return $ vi ; } else { $ vi = new VendorInfo ( ) ; $ vi -> loadFromXML ( $ data ) ; return $ this -> addVendorInfo ( $ vi ) ; } }
Sets an associated VendorInfo object .
3,777
public function getVendorInfoForType ( $ type ) { if ( isset ( $ this -> vendorInfos [ $ type ] ) ) { return $ this -> vendorInfos [ $ type ] ; } else { return new VendorInfo ( $ type ) ; } }
Gets the any associated VendorInfo object .
3,778
public function toString ( ) { $ doc = new DOMDocument ( '1.0' ) ; $ doc -> formatOutput = true ; $ this -> appendXml ( $ doc ) ; $ xmlstr = $ doc -> saveXML ( ) ; return trim ( preg_replace ( '/<\?xml.*?\?>/' , '' , $ xmlstr ) ) ; }
String representation of the current object .
3,779
public function modifyTable ( ) { $ table = $ this -> getTable ( ) ; $ database = $ table -> getDatabase ( ) ; $ delegates = explode ( ',' , $ this -> parameters [ 'to' ] ) ; foreach ( $ delegates as $ delegate ) { $ delegate = $ database -> getTablePrefix ( ) . trim ( $ delegate ) ; if ( ! $ database -> hasTable ( $ d...
Lists the delegates and checks that the behavior can use them And adds a fk from the delegate to the main table if not already set
3,780
public function appendModelClauseSeveralToPs ( & $ sb , array & $ params ) { $ clause = $ this -> clause ; foreach ( ( array ) $ this -> value as $ value ) { if ( $ value === null ) { throw new PropelException ( 'Null values are not supported inside BETWEEN clauses' ) ; } $ params [ ] = array ( 'table' => $ this -> rea...
Appends a Prepared Statement representation of the ModelCriterion onto the buffer For ternary model clauses e . G book . ID BETWEEN ? AND ?
3,781
public function log ( $ message , $ severity = null ) { if ( is_null ( $ this -> logger ) ) { $ this -> logger = LogManager :: getLogger ( 'propel' ) ; } switch ( $ severity ) { case 'crit' : $ method = 'fatal' ; break ; case 'err' : $ method = 'error' ; break ; case 'alert' : case 'warning' : $ method = 'warning' ; br...
Primary method to handle logging .
3,782
public function fromArray ( $ array , $ isList = false , $ includeHeading = true ) { $ rows = array ( ) ; if ( $ isList ) { if ( $ includeHeading ) { $ rows [ ] = implode ( $ this -> formatRow ( array_keys ( reset ( $ array ) ) ) , $ this -> delimiter ) ; } foreach ( $ array as $ row ) { $ rows [ ] = implode ( $ this -...
Converts data from an associative array to CSV .
3,783
protected function formatRow ( $ row ) { foreach ( $ row as & $ column ) { if ( ! is_scalar ( $ column ) ) { $ column = $ this -> serialize ( $ column ) ; } switch ( $ this -> quoting ) { case self :: QUOTE_NONE : break ; case self :: QUOTE_ALL : $ column = $ this -> quote ( $ this -> escape ( $ column ) ) ; break ; ca...
Accepts a row of data and returns it formatted
3,784
protected function containsSpecialChars ( $ input ) { $ special_chars = str_split ( $ this -> lineTerminator , 1 ) ; $ special_chars [ ] = $ this -> quotechar ; $ special_chars [ ] = $ this -> delimiter ; foreach ( $ special_chars as $ char ) { if ( strpos ( $ input , $ char ) !== false ) { return true ; } } return fal...
Returns true if input contains quotechar delimiter or any of the characters in lineTerminator
3,785
public function formatTemporalValue ( $ value , $ type ) { if ( $ dt = PropelDateTime :: newInstance ( $ value ) ) { if ( $ type instanceof ColumnMap ) { $ type = $ type -> getType ( ) ; } switch ( $ type ) { case PropelColumnTypes :: TIMESTAMP : case PropelColumnTypes :: BU_TIMESTAMP : $ value = $ dt -> format ( $ thi...
Formats a temporal value before binding given a ColumnMap object .
3,786
protected function addClassClose ( & $ script ) { $ this -> applyBehaviorModifier ( 'staticMethods' , $ script , " " ) ; $ script .= "} // " . $ this -> getClassname ( ) . "" ; $ this -> addStaticTableMapRegistration ( $ script ) ; }
Closes class . Adds closing brace at end of class and the static map builder registration code .
3,787
protected function addStaticTableMapRegistration ( & $ script ) { $ table = $ this -> getTable ( ) ; $ script .= "// This is the static code needed to register the TableMap for this table with the main Propel class.//" . $ this -> getClassName ( ) . "::buildTableMap();" ; $ this -> applyBehaviorModifier ( 'peerFilter' ...
Adds the static map builder registration code .
3,788
protected function addConstantsAndAttributes ( & $ script ) { $ dbName = $ this -> getDatabase ( ) -> getName ( ) ; $ tableName = $ this -> getTable ( ) -> getName ( ) ; $ tablePhpName = $ this -> getTable ( ) -> isAbstract ( ) ? '' : addslashes ( $ this -> getStubObjectBuilder ( ) -> getFullyQualifiedClassname ( ) ) ;...
Adds constant and variable declarations that go at the top of the class .
3,789
protected function addEnumColumnConstants ( & $ script ) { foreach ( $ this -> getTable ( ) -> getColumns ( ) as $ col ) { if ( $ col -> isEnumType ( ) || $ col -> getValueSet ( ) ) { $ script .= " /** The enumerated values for the " . $ col -> getName ( ) . " field */" ; foreach ( $ col -> getValueSet ( ) as $ valu...
Adds the valueSet constants for ENUM columns .
3,790
protected function addEnumMethods ( & $ script ) { foreach ( $ this -> getTable ( ) -> getColumns ( ) as $ col ) { if ( $ col -> isEnumType ( ) ) { $ script .= " /** * Gets the SQL value for " . $ col -> getPhpName ( ) . " ENUM value * * @param string \$enumVal ENUM value to get SQL value for * @ret...
Adds methods for ENUM columns .
3,791
public function getInstancePoolKeySnippet ( $ pkphp ) { $ pkphp = ( array ) $ pkphp ; $ script = "" ; if ( count ( $ pkphp ) > 1 ) { $ script .= "serialize(array(" ; $ i = 0 ; foreach ( $ pkphp as $ pkvar ) { $ script .= ( $ i ++ ? ', ' : '' ) . "(string) $pkvar" ; } $ script .= "))" ; } else { $ script .= "(string) " ...
Adds the PHP code to return a instance pool key for the passed - in primary key variable names .
3,792
protected function addAddInstanceToPool ( & $ script ) { $ table = $ this -> getTable ( ) ; $ script .= " /** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you overrid...
Creates a convenience method to add objects to an instance pool .
3,793
protected function addRemoveInstanceFromPool ( & $ script ) { $ table = $ this -> getTable ( ) ; $ script .= " /** * Removes an object from the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when y...
Creates a convenience method to remove objects form an instance pool .
3,794
protected function addClearRelatedInstancePool ( & $ script ) { $ table = $ this -> getTable ( ) ; $ script .= " /** * Method to invalidate the instance pool of all tables related to " . $ table -> getName ( ) . " * by a foreign key with ON DELETE CASCADE */ public static function clearRelatedInstance...
Adds method to clear the instance pool of related tables .
3,795
protected function addRetrieveByPK_SinglePK ( & $ script ) { $ table = $ this -> getTable ( ) ; $ pks = $ table -> getPrimaryKey ( ) ; $ col = $ pks [ 0 ] ; $ script .= " /** * Retrieve a single object by pkey. * * @param " . $ col -> getPhpType ( ) . " \$pk the primary key. * @param PropelPDO \...
Adds the retrieveByPK method for tables with single - column primary key .
3,796
protected function addRetrieveByPKs_SinglePK ( & $ script ) { $ table = $ this -> getTable ( ) ; $ script .= " /** * Retrieve multiple objects by pkey. * * @param array \$pks List of primary keys * @param PropelPDO \$con the connection to use * @return " . $ this -> getObjectClassname (...
Adds the retrieveByPKs method for tables with single - column primary key .
3,797
protected function addRetrieveByPK_MultiPK ( & $ script ) { $ table = $ this -> getTable ( ) ; $ script .= " /** * Retrieve object using using composite pkey values." ; foreach ( $ table -> getPrimaryKey ( ) as $ col ) { $ clo = strtolower ( $ col -> getName ( ) ) ; $ cptype = $ col -> getPhpType ( ) ; $ script ...
Adds the retrieveByPK method for tables with multi - column primary key .
3,798
protected function initialize ( ) { $ this -> schemaDomainMap = array ( ) ; foreach ( PropelTypes :: getPropelTypes ( ) as $ type ) { $ this -> schemaDomainMap [ $ type ] = new Domain ( $ type ) ; } $ this -> schemaDomainMap [ PropelTypes :: BU_DATE ] = new Domain ( PropelTypes :: DATE ) ; $ this -> schemaDomainMap [ P...
Initialize the type - > Domain mapping .
3,799
public function getDomainForType ( $ propelType ) { if ( ! isset ( $ this -> schemaDomainMap [ $ propelType ] ) ) { throw new EngineException ( "Cannot map unknown Propel type " . var_export ( $ propelType , true ) . " to native database type." ) ; } return $ this -> schemaDomainMap [ $ propelType ] ; }
Returns the db specific domain for a propelType .