idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
48,300
protected function phpnameMethod ( $ schemaName ) { $ name = '' ; $ tok = strtok ( $ schemaName , self :: STD_SEPARATOR_CHAR ) ; while ( false !== $ tok ) { $ name .= ucfirst ( $ tok ) ; $ tok = strtok ( self :: STD_SEPARATOR_CHAR ) ; } return $ name ; }
Converts a database schema name to php object name . Operates same as underscoreMethod but does not convert anything to lowercase .
48,301
public function getConstantSuffix ( ) { $ separator = PhpNameGenerator :: STD_SEPARATOR_CHAR ; return strtoupper ( rtrim ( preg_replace ( '/(\W|_)+/' , $ separator , $ this -> key ) , $ separator ) ) ; }
Get constant names safe value of the key name .
48,302
public function getUnclassifiedPrimaryKeys ( ) { $ pks = [ ] ; foreach ( $ this -> getMiddleTable ( ) -> getPrimaryKey ( ) as $ pk ) { $ unclassified = true ; if ( $ this -> getIncomingForeignKey ( ) -> hasLocalColumn ( $ pk ) ) { $ unclassified = false ; } if ( $ unclassified ) { foreach ( $ this -> getCrossForeignKey...
Returns all primary keys of middle - table which are not already covered by at least on of our cross foreignKey collection .
48,303
public function getBuildConnections ( ) { if ( null === $ this -> buildConnections ) { $ connectionNames = $ this -> get ( ) [ 'generator' ] [ 'connections' ] ; $ reverseConnection = $ this -> getConfigProperty ( 'reverse.connection' ) ; if ( null !== $ reverseConnection && ! in_array ( $ reverseConnection , $ connecti...
Return an array of all configured connection properties from generator and reverse sections of the configuration .
48,304
public function getBuildConnection ( $ databaseName = null ) { if ( null === $ databaseName ) { $ databaseName = $ this -> get ( ) [ 'generator' ] [ 'defaultConnection' ] ; } if ( ! array_key_exists ( $ databaseName , $ this -> getBuildConnections ( ) ) ) { throw new InvalidArgumentException ( "Invalid database name: n...
Return the connection properties array of a given database name . If the database name is null it returns the default connection properties
48,305
public function getConnection ( $ database = null ) { $ buildConnection = $ this -> getBuildConnection ( $ database ) ; $ dsn = $ buildConnection [ 'dsn' ] ; $ username = isset ( $ buildConnection [ 'user' ] ) && $ buildConnection [ 'user' ] ? $ buildConnection [ 'user' ] : null ; $ password = isset ( $ buildConnection...
Return a connection object of a given database name
48,306
public function getSection ( $ section ) { if ( ! array_key_exists ( $ section , $ this -> config ) ) { return null ; } return $ this -> config [ $ section ] ; }
Return a specific section of the configuration array . It ca be useful to get in example only generator values .
48,307
public function getConnectionParametersArray ( $ section = 'runtime' ) { if ( ! in_array ( $ section , [ 'runtime' , 'generator' ] ) ) { return null ; } $ output = [ ] ; foreach ( $ this -> config [ $ section ] [ 'connections' ] as $ connection ) { $ output [ $ connection ] = $ this -> config [ 'database' ] [ 'connecti...
Return an array of parameters relative to configured connections for runtime or generator section . It s useful for \ Propel \ Generator \ Command \ ConfigConvertCommand class
48,308
protected function process ( $ extraConf = null ) { if ( null === $ extraConf && count ( $ this -> config ) <= 0 ) { return null ; } $ processor = new Processor ( ) ; $ configuration = new PropelConfiguration ( ) ; if ( is_array ( $ extraConf ) ) { $ this -> config = array_replace_recursive ( $ this -> config , $ extra...
Validate the configuration array via Propel \ Common \ Config \ PropelConfiguration class and add default values .
48,309
private function getDirs ( $ fileName ) { if ( is_file ( $ fileName ) ) { return [ ] ; } $ currentDir = getcwd ( ) ; if ( is_dir ( $ fileName ) ) { $ currentDir = $ fileName ; } $ dirs [ ] = $ currentDir ; if ( is_dir ( $ currentDir . '/conf' ) ) { $ dirs [ ] = $ currentDir . '/conf' ; } if ( is_dir ( $ currentDir . '/...
Return the directories where to find the configuration file .
48,310
private function cleanupSlaveConnections ( ) { foreach ( $ this -> config [ 'database' ] [ 'connections' ] as $ name => $ connection ) { if ( count ( $ connection [ 'slaves' ] ) <= 0 ) { unset ( $ this -> config [ 'database' ] [ 'connections' ] [ $ name ] [ 'slaves' ] ) ; } } }
Remove empty slaves array from configured connections .
48,311
private function cleanupConnections ( ) { foreach ( [ 'runtime' , 'generator' ] as $ section ) { if ( ! isset ( $ this -> config [ $ section ] [ 'connections' ] ) || count ( $ this -> config [ $ section ] [ 'connections' ] ) === 0 ) { $ this -> config [ $ section ] [ 'connections' ] = array_keys ( $ this -> config [ 'd...
If not defined set runtime and generator connections based on database . connections property . Check if runtime and generator connections are correctly defined .
48,312
public static function computeDiff ( Database $ fromDatabase , Database $ toDatabase , $ caseInsensitive = false , $ withRenaming = false , $ removeTable = true , $ excludedTables = [ ] ) { $ databaseComparator = new self ( ) ; $ databaseComparator -> setFromDatabase ( $ fromDatabase ) ; $ databaseComparator -> setToDa...
Returns the computed difference between two database objects .
48,313
public function compareTables ( $ caseInsensitive = false ) { $ fromDatabaseTables = $ this -> fromDatabase -> getTables ( ) ; $ toDatabaseTables = $ this -> toDatabase -> getTables ( ) ; $ databaseDifferences = 0 ; foreach ( $ toDatabaseTables as $ table ) { if ( $ this -> isTableExcluded ( $ table ) ) { continue ; } ...
Returns the number of differences .
48,314
public function getPackage ( ) { $ pkg = ( $ this -> getTable ( ) -> getPackage ( ) ? $ this -> getTable ( ) -> getPackage ( ) : $ this -> getDatabase ( ) -> getPackage ( ) ) ; if ( ! $ pkg ) { $ pkg = $ this -> getBuildProperty ( 'generator.targetPackage' ) ; } return $ pkg ; }
Gets package name for this table . This is overridden by child classes that have different packages .
48,315
public function getClassNameFromTable ( Table $ table , $ fqcn = false ) { $ namespace = $ table -> getNamespace ( ) ; $ class = $ table -> getPhpName ( ) ; return $ this -> declareClassNamespace ( $ class , $ namespace , true ) ; }
This declares the class use and returns the correct name to use
48,316
public function declareClassNamespace ( $ class , $ namespace = '' , $ alias = false ) { $ namespace = trim ( $ namespace , '\\' ) ; if ( isset ( $ this -> declaredClasses [ $ namespace ] ) && isset ( $ this -> declaredClasses [ $ namespace ] [ $ class ] ) ) { return $ this -> declaredClasses [ $ namespace ] [ $ class ...
Declare a class to be use and return it s name or it s alias
48,317
public function getUseStatements ( $ ignoredNamespace = null ) { $ script = '' ; $ declaredClasses = $ this -> declaredClasses ; unset ( $ declaredClasses [ $ ignoredNamespace ] ) ; ksort ( $ declaredClasses ) ; foreach ( $ declaredClasses as $ namespace => $ classes ) { asort ( $ classes ) ; foreach ( $ classes as $ c...
Return all the use statement of the class
48,318
protected function extractCrossInformation ( CrossForeignKeys $ crossFKs , $ crossFKToIgnore = null , & $ signature , & $ shortSignature , & $ normalizedShortSignature , & $ phpDoc ) { foreach ( $ crossFKs -> getCrossForeignKeys ( ) as $ fk ) { if ( is_array ( $ crossFKToIgnore ) && in_array ( $ fk , $ crossFKToIgnore ...
Extracts some useful information from a CrossForeignKeys object .
48,319
public function getBehaviorContentBase ( $ contentName , $ modifier ) { $ modifierGetter = 'get' . $ modifier ; foreach ( $ this -> getTable ( ) -> getBehaviors ( ) as $ behavior ) { $ modifier = $ behavior -> $ modifierGetter ( ) ; if ( method_exists ( $ modifier , $ contentName ) ) { return $ modifier -> $ contentNam...
Checks whether any registered behavior content creator on that table exists a contentName
48,320
public function renderTemplate ( $ filename , $ vars = [ ] , $ templateDir = '/templates/' ) { $ filePath = __DIR__ . $ templateDir . $ filename ; if ( ! file_exists ( $ filePath ) ) { $ filePath = $ filePath . '.php' ; if ( ! file_exists ( $ filePath ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Template "%s...
Use Propel simple templating system to render a PHP file using variables passed as arguments . The template file name is relative to the behavior s directory name .
48,321
private function clean ( $ content ) { $ content = str_replace ( "\r\n" , "\n" , $ content ) ; $ content = preg_replace ( '/[ \t]*$/m' , '' , $ content ) ; $ content = preg_replace_callback ( '/^([ \t]+)/m' , function ( $ matches ) use ( $ content ) { return str_replace ( "\t" , ' ' , $ matches [ 0 ] ) ; } , $ conte...
Most of the code comes from the PHP - CS - Fixer project
48,322
public function setAttribute ( $ attribute , $ value ) { switch ( $ attribute ) { case 'isSlowOnly' : $ this -> isSlowOnly = $ value ; break ; default : parent :: setAttribute ( $ attribute , $ value ) ; } }
Overrides the parent setAttribute to support the isSlowOnly attribute .
48,323
public function getWriteConnection ( AdapterInterface $ adapter = null ) { if ( null === $ this -> writeConnection ) { $ this -> writeConnection = ConnectionFactory :: create ( $ this -> writeConfiguration , $ adapter ) ; $ this -> writeConnection -> setName ( $ this -> getName ( ) ) ; } return $ this -> writeConnectio...
Get a master connection .
48,324
public function getReadConnection ( AdapterInterface $ adapter = null ) { if ( $ this -> writeConnection && $ this -> writeConnection -> inTransaction ( ) ) { return $ this -> writeConnection ; } if ( $ this -> isForceMasterConnection ( ) ) { return $ this -> getWriteConnection ( $ adapter ) ; } if ( null === $ this ->...
Get a slave connection .
48,325
public function toArray ( $ data , $ rootKey = null , $ isList = false , $ includeHeading = true ) { $ rows = explode ( $ this -> lineTerminator , $ data ) ; if ( $ includeHeading ) { $ heading = array_shift ( $ rows ) ; $ keys = explode ( $ this -> delimiter , $ heading ) ; } else { $ keys = range ( 0 , count ( $ this...
Converts data from CSV to an associative array .
48,326
protected function cleanupRow ( $ row ) { foreach ( $ row as $ key => $ column ) { if ( $ this -> isQuoted ( $ column ) ) { $ column = $ this -> unescape ( $ this -> unquote ( $ column ) ) ; } if ( $ this -> isSerialized ( $ column ) ) { $ column = $ this -> unserialize ( $ column ) ; } if ( 'N;' === $ column ) { $ col...
Accepts a formatted row of data and returns it raw
48,327
protected function getDefaultValueForSet ( $ stringValue ) { $ stringValue = trim ( $ stringValue ) ; if ( empty ( $ stringValue ) ) { return null ; } $ values = [ ] ; foreach ( explode ( ',' , $ stringValue ) as $ v ) { $ values [ ] = trim ( $ v ) ; } if ( count ( $ values ) === 0 ) { return null ; } return $ values ;...
Converts the default string for set columns to an array .
48,328
public function addVendorInfo ( $ vendor ) { if ( $ vendor instanceof VendorInfo ) { $ this -> vendorInfos [ $ vendor -> getType ( ) ] = $ vendor ; return $ vendor ; } $ vi = new VendorInfo ( ) ; $ vi -> loadMapping ( $ vendor ) ; return $ this -> addVendorInfo ( $ vi ) ; }
Adds a new VendorInfo instance to this current model object .
48,329
public function endUse ( ) { if ( isset ( $ this -> aliases [ $ this -> modelAlias ] ) ) { $ this -> removeAlias ( $ this -> modelAlias ) ; } $ primaryCriteria = $ this -> getPrimaryCriteria ( ) ; $ primaryCriteria -> mergeWith ( $ this ) ; return $ primaryCriteria ; }
Finalizes a secondary criteria and merges it with its primary Criteria
48,330
public function setPrimaryCriteria ( ModelCriteria $ criteria , Join $ previousJoin ) { $ this -> primaryCriteria = $ criteria ; $ this -> setPreviousJoin ( $ previousJoin ) ; }
Sets the primary Criteria for this secondary Criteria
48,331
public function addSelfSelectColumns ( $ force = false ) { if ( $ this -> isSelfSelected && ! $ force ) { return $ this ; } $ tableMap = $ this -> modelTableMapName ; $ tableMap :: addSelectColumns ( $ this , $ this -> useAliasInSQL ? $ this -> modelAlias : null ) ; $ this -> isSelfSelected = true ; return $ this ; }
Adds the select columns for the current table
48,332
public function exists ( ConnectionInterface $ con = null ) { if ( null === $ con ) { $ con = Propel :: getServiceContainer ( ) -> getReadConnection ( $ this -> getDbName ( ) ) ; } $ this -> basePreSelect ( $ con ) ; $ criteria = $ this -> isKeepQuery ( ) ? clone $ this : $ this ; $ criteria -> setDbName ( $ this -> ge...
Issue an existence check on the current ModelCriteria
48,333
public function paginate ( $ page = 1 , $ maxPerPage = 10 , ConnectionInterface $ con = null ) { $ criteria = $ this -> isKeepQuery ( ) ? clone $ this : $ this ; $ pager = new PropelModelPager ( $ criteria , $ maxPerPage ) ; $ pager -> setPage ( $ page ) ; $ pager -> init ( $ con ) ; return $ pager ; }
Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit .
48,334
protected function getCriterionForConditions ( $ conditions , $ operator = null ) { $ operator = ( null === $ operator ) ? Criteria :: LOGICAL_AND : $ operator ; $ this -> combine ( $ conditions , $ operator , 'propel_temp_name' ) ; $ criterion = $ this -> namedCriterions [ 'propel_temp_name' ] ; unset ( $ this -> name...
Creates a Criterion object based on a list of existing condition names and a comparator
48,335
protected function getColumnFromSubQuery ( $ class , $ phpName , $ failSilently = true ) { $ subQueryCriteria = $ this -> getSelectQuery ( $ class ) ; $ tableMap = $ subQueryCriteria -> getTableMap ( ) ; if ( $ tableMap -> hasColumnByPhpName ( $ phpName ) ) { $ column = $ tableMap -> getColumnByPhpName ( $ phpName ) ; ...
Special case for subquery columns
48,336
public function getDomainForType ( $ mappingType ) { if ( ! isset ( $ this -> schemaDomainMap [ $ mappingType ] ) ) { throw new EngineException ( sprintf ( 'Cannot map unknown Propel type %s to native database type.' , var_export ( $ mappingType , true ) ) ) ; } return $ this -> schemaDomainMap [ $ mappingType ] ; }
Returns the database specific domain for a mapping type .
48,337
public function getAddIndicesDDL ( Table $ table ) { $ ret = '' ; foreach ( $ table -> getIndices ( ) as $ fk ) { $ ret .= $ this -> getAddIndexDDL ( $ fk ) ; } return $ ret ; }
Returns the DDL SQL to add the indices of a table .
48,338
public function getAddIndexDDL ( Index $ index ) { $ pattern = "CREATE %sINDEX %s ON %s (%s);" ; return sprintf ( $ pattern , $ index -> isUnique ( ) ? 'UNIQUE ' : '' , $ this -> quoteIdentifier ( $ index -> getName ( ) ) , $ this -> quoteIdentifier ( $ index -> getTable ( ) -> getName ( ) ) , $ this -> getColumnListDD...
Returns the DDL SQL to add an Index .
48,339
public function getAddForeignKeyDDL ( ForeignKey $ fk ) { if ( $ fk -> isSkipSql ( ) || $ fk -> isPolymorphic ( ) ) { return ; } $ pattern = "ALTER TABLE %s ADD %s;" ; return sprintf ( $ pattern , $ this -> quoteIdentifier ( $ fk -> getTable ( ) -> getName ( ) ) , $ this -> getForeignKeyDDL ( $ fk ) ) ; }
Builds the DDL SQL to add a foreign key .
48,340
public function getModifyTablePrimaryKeyDDL ( TableDiff $ tableDiff ) { $ ret = '' ; if ( $ tableDiff -> hasModifiedPk ( ) ) { $ ret .= $ this -> getDropPrimaryKeyDDL ( $ tableDiff -> getFromTable ( ) ) ; $ ret .= $ this -> getAddPrimaryKeyDDL ( $ tableDiff -> getToTable ( ) ) ; } return $ ret ; }
Builds the DDL SQL to alter a table s primary key based on a TableDiff instance
48,341
public function getModifyTableIndicesDDL ( TableDiff $ tableDiff ) { $ ret = '' ; foreach ( $ tableDiff -> getRemovedIndices ( ) as $ index ) { $ ret .= $ this -> getDropIndexDDL ( $ index ) ; } foreach ( $ tableDiff -> getAddedIndices ( ) as $ index ) { $ ret .= $ this -> getAddIndexDDL ( $ index ) ; } foreach ( $ tab...
Builds the DDL SQL to alter a table s indices based on a TableDiff instance
48,342
public function getModifyTableForeignKeysDDL ( TableDiff $ tableDiff ) { $ ret = '' ; foreach ( $ tableDiff -> getRemovedFks ( ) as $ fk ) { $ ret .= $ this -> getDropForeignKeyDDL ( $ fk ) ; } foreach ( $ tableDiff -> getAddedFks ( ) as $ fk ) { $ ret .= $ this -> getAddForeignKeyDDL ( $ fk ) ; } foreach ( $ tableDiff...
Builds the DDL SQL to alter a table s foreign keys based on a TableDiff instance
48,343
public function getModifyColumnsDDL ( $ columnDiffs ) { $ lines = [ ] ; $ table = null ; foreach ( $ columnDiffs as $ columnDiff ) { $ toColumn = $ columnDiff -> getToColumn ( ) ; if ( null === $ table ) { $ table = $ toColumn -> getTable ( ) ; } $ lines [ ] = $ this -> getColumnDDL ( $ toColumn ) ; } $ sep = ", " ;...
Builds the DDL SQL to modify a list of columns
48,344
public function quote ( $ text ) { if ( $ con = $ this -> getConnection ( ) ) { return $ con -> quote ( $ text ) ; } else { return "'" . $ this -> disconnectedEscapeText ( $ text ) . "'" ; } }
Quote and escape needed characters in the string for underlying RDBMS .
48,345
public function getBooleanString ( $ b ) { if ( is_bool ( $ b ) && true === $ b ) { return '1' ; } if ( is_int ( $ b ) && 1 === $ b ) { return '1' ; } if ( is_string ( $ b ) && in_array ( strtolower ( $ b ) , [ '1' , 'true' , 'y' , 'yes' ] ) ) { return '1' ; } return '0' ; }
Returns the Boolean value for the RDBMS .
48,346
public function getDefaultTypeSize ( $ type ) { $ sizes = $ this -> getDefaultTypeSizes ( ) ; return isset ( $ sizes [ strtolower ( $ type ) ] ) ? $ sizes [ strtolower ( $ type ) ] : null ; }
Returns the default size of a specific type .
48,347
protected function getConnectionInstance ( $ datasource ) { $ buildConnection = $ this -> getConnection ( $ datasource ) ; $ dsn = str_replace ( "@DB@" , $ datasource , $ buildConnection [ 'dsn' ] ) ; $ username = isset ( $ buildConnection [ 'user' ] ) && $ buildConnection [ 'user' ] ? $ buildConnection [ 'user' ] : nu...
Returns a ConnectionInterface instance for a given datasource .
48,348
public function getFirst ( ) { if ( 0 === count ( $ this -> data ) ) { return null ; } reset ( $ this -> data ) ; return current ( $ this -> data ) ; }
Get the first element in the collection
48,349
public function getLast ( ) { if ( 0 === $ this -> count ( ) ) { return null ; } end ( $ this -> data ) ; return current ( $ this -> data ) ; }
Get the last element in the collection
48,350
public function shift ( ) { $ arr = $ this -> getArrayCopy ( ) ; $ ret = array_shift ( $ arr ) ; $ this -> exchangeArray ( $ arr ) ; return $ ret ; }
Pops an element off the beginning of the collection
48,351
public function prepend ( $ value ) { $ arr = $ this -> getArrayCopy ( ) ; $ ret = array_unshift ( $ arr , $ value ) ; $ this -> exchangeArray ( $ arr ) ; return $ ret ; }
Prepend one or more elements to the beginning of the collection
48,352
public function setModel ( $ model ) { if ( false !== $ pos = strrpos ( $ model , '\\' ) ) { $ this -> model = substr ( $ model , $ pos + 1 ) ; } else { $ this -> model = $ model ; } $ this -> fullyQualifiedModel = ( ( 0 === strpos ( $ model , '\\' ) ) ? '' : '\\' ) . $ model ; }
Set the model of the elements in the collection
48,353
protected static function getAlgorithm ( $ name ) { if ( ! isset ( self :: $ algorithms [ $ name ] ) ) { self :: $ algorithms [ $ name ] = new $ name ( ) ; } return self :: $ algorithms [ $ name ] ; }
Factory method which retrieves an instance of the named generator .
48,354
public function rewind ( ) { if ( $ this -> dataObject ) $ this -> current = $ this -> dataObject -> fetch ( $ this -> style ) ; }
Not supported in PDODataFetcher . It actually fetches the first row since a foreach in php triggers that function as init .
48,355
public function bindColumn ( $ column , & $ param , $ type = null , $ maxlen = null , $ driverdata = null ) { if ( $ this -> dataObject ) $ this -> dataObject -> bindColumn ( $ column , $ param , $ type , $ maxlen , $ driverdata ) ; }
Bind a column to a PHP variable .
48,356
private function addCriterionTable ( AbstractCriterion $ c , array & $ s ) { $ s [ ] = $ c -> getTable ( ) ; foreach ( $ c -> getClauses ( ) as $ clause ) { $ this -> addCriterionTable ( $ clause , $ s ) ; } }
method supporting recursion through all criterions to give us a string array of tables from each criterion
48,357
public function getAttachedCriterion ( ) { $ criterions = [ $ this ] ; foreach ( $ this -> getClauses ( ) as $ criterion ) { $ criterions = array_merge ( $ criterions , $ criterion -> getAttachedCriterion ( ) ) ; } return $ criterions ; }
get an array of all criterion attached to this recursing through all sub criterion
48,358
public function toArray ( $ data , $ rootKey = null ) { $ data = json_decode ( $ data , true ) ; if ( $ rootKey === null ) { return $ data ; } if ( ! isset ( $ data [ $ rootKey ] ) ) { return [ ] ; } return $ data [ $ rootKey ] ; }
Converts data from JSON to an associative array .
48,359
public function init ( ModelJoin $ join ) { $ tableMap = $ join -> getTableMap ( ) ; $ this -> setModelName ( $ tableMap -> getClassName ( ) ) ; $ this -> getTableMap = $ tableMap ; $ this -> isSingleTableInheritance = $ tableMap -> isSingleTableInheritance ( ) ; $ relation = $ join -> getRelationMap ( ) ; $ relationNa...
Define the joined hydration schema based on a join object . Fills the ModelWith properties using a ModelJoin as source
48,360
public function setModelName ( $ modelName ) { if ( 0 === strpos ( $ modelName , '\\' ) ) { $ this -> modelName = substr ( $ modelName , 1 ) ; } else { $ this -> modelName = $ modelName ; } }
DataObject getters & setters
48,361
public function getLeftColumn ( $ index = 0 ) { $ tableName = $ this -> getLeftTableAliasOrName ( ) ; return $ tableName ? $ tableName . '.' . $ this -> left [ $ index ] : $ this -> left [ $ index ] ; }
Get the fully qualified name of the left column of the join condition
48,362
private function findComposerFile ( $ fileName ) { if ( null !== $ this -> composerDir ) { $ filePath = $ this -> composerDir . '/' . $ fileName ; if ( file_exists ( $ filePath ) ) { return new SplFileInfo ( $ filePath , dirname ( $ filePath ) , dirname ( $ filePath ) ) ; } } $ finder = new Finder ( ) ; $ result = $ fi...
Searches a composer file
48,363
public function getBehaviors ( ) { if ( null === $ this -> behaviors ) { $ lock = $ this -> findComposerLock ( ) ; if ( null === $ lock ) { $ this -> behaviors = [ ] ; } else { $ this -> behaviors = $ this -> loadBehaviors ( $ lock ) ; } $ json = $ this -> findComposerJson ( ) ; if ( null !== $ json ) { $ behavior = $ ...
Returns the loaded behaviors and loads them if not done before
48,364
public function getBehavior ( $ name ) { if ( false !== strpos ( $ name , '\\' ) ) { $ class = $ name ; } else { $ class = $ this -> getCoreBehavior ( $ name ) ; if ( ! class_exists ( $ class ) ) { $ behaviors = $ this -> getBehaviors ( ) ; if ( array_key_exists ( $ name , $ behaviors ) ) { $ class = $ behaviors [ $ na...
Returns the class name for a given behavior name
48,365
private function loadBehaviors ( $ composerLock ) { $ behaviors = [ ] ; if ( null === $ composerLock ) { return $ behaviors ; } $ json = json_decode ( $ composerLock -> getContents ( ) , true ) ; if ( isset ( $ json [ 'packages' ] ) ) { foreach ( $ json [ 'packages' ] as $ package ) { $ behavior = $ this -> loadBehavio...
Finds all behaviors by parsing composer . lock file
48,366
private function loadBehavior ( $ package ) { if ( isset ( $ package [ 'type' ] ) && $ package [ 'type' ] == self :: BEHAVIOR_PACKAGE_TYPE ) { if ( isset ( $ package [ 'extra' ] ) ) { $ extra = $ package [ 'extra' ] ; if ( isset ( $ extra [ 'name' ] ) && isset ( $ extra [ 'class' ] ) ) { return [ 'name' => $ extra [ 'n...
Reads the propel behavior data from a given composer package
48,367
public function getPhpDefaultValue ( ) { if ( null === $ this -> defaultValue ) { return null ; } if ( $ this -> defaultValue -> isExpression ( ) ) { throw new EngineException ( 'Cannot get PHP version of default value for default value EXPRESSION.' ) ; } if ( in_array ( $ this -> mappingType , [ PropelTypes :: BOOLEAN...
Returns the default value type - casted for use in PHP OM .
48,368
public function getSizeDefinition ( ) { if ( null === $ this -> size ) { return '' ; } if ( null !== $ this -> scale ) { return sprintf ( '(%u,%u)' , $ this -> size , $ this -> scale ) ; } return sprintf ( '(%u)' , $ this -> size ) ; }
Returns the size and scale in brackets for use in an sql schema .
48,369
public function normalizeFKey ( $ behavior ) { if ( null === $ behavior ) { return self :: NONE ; } $ behavior = strtoupper ( $ behavior ) ; if ( 'NONE' === $ behavior ) { return self :: NONE ; } if ( 'SETNULL' === $ behavior ) { return self :: SETNULL ; } return $ behavior ; }
Returns the normalized input of onDelete and onUpdate behaviors .
48,370
public function getForeignTableName ( ) { $ platform = $ this -> getPlatform ( ) ; if ( $ this -> foreignSchemaName && $ platform -> supportsSchemas ( ) ) { return $ this -> foreignSchemaName . $ platform -> getSchemaDelimiter ( ) . $ this -> foreignTableCommonName ; } $ database = $ this -> getDatabase ( ) ; if ( $ da...
Returns the foreign table name of the FK .
48,371
public function getLocalColumnObjects ( ) { $ columns = [ ] ; foreach ( $ this -> localColumns as $ columnName ) { $ columns [ ] = $ this -> parentTable -> getColumn ( $ columnName ) ; } return $ columns ; }
Returns an array of local column objects .
48,372
public function getColumnObjectsMapping ( ) { $ mapping = [ ] ; $ foreignTable = $ this -> getForeignTable ( ) ; for ( $ i = 0 , $ size = count ( $ this -> localColumns ) ; $ i < $ size ; $ i ++ ) { $ mapping [ ] = [ 'local' => $ this -> parentTable -> getColumn ( $ this -> localColumns [ $ i ] ) , 'foreign' => $ forei...
Returns an array of local and foreign column objects mapped for this foreign key .
48,373
public function getMappedForeignColumn ( $ local ) { $ index = array_search ( $ local , $ this -> localColumns ) ; return $ this -> foreignColumns [ $ index ] ; }
Returns the foreign column name mapped to a specified local column .
48,374
public function getMappedLocalColumn ( $ foreign ) { $ index = array_search ( $ foreign , $ this -> foreignColumns ) ; return $ this -> localColumns [ $ index ] ; }
Returns the local column name mapped to a specified foreign column .
48,375
public function getForeignColumnObjects ( ) { $ columns = [ ] ; $ foreignTable = $ this -> getForeignTable ( ) ; foreach ( $ this -> foreignColumns as $ columnName ) { $ column = $ foreignTable -> getColumn ( $ columnName ) ; if ( null !== $ column ) { $ columns [ ] = $ column ; } } return $ columns ; }
Returns an array of foreign column objects .
48,376
public function isLocalColumnsRequired ( ) { foreach ( $ this -> localColumns as $ columnName ) { if ( ! $ this -> parentTable -> getColumn ( $ columnName ) -> isNotNull ( ) ) { return false ; } } return true ; }
Returns whether this foreign key uses only required local columns .
48,377
public function isForeignPrimaryKey ( ) { $ foreignTable = $ this -> getForeignTable ( ) ; $ foreignPKCols = [ ] ; foreach ( $ foreignTable -> getPrimaryKey ( ) as $ fPKCol ) { $ foreignPKCols [ ] = $ fPKCol -> getName ( ) ; } $ foreignCols = [ ] ; foreach ( $ this -> localColumns as $ idx => $ colName ) { if ( $ this ...
Returns whether this foreign key is also the primary key of the foreign table .
48,378
public function isLocalPrimaryKey ( ) { $ localPKCols = [ ] ; foreach ( $ this -> parentTable -> getPrimaryKey ( ) as $ lPKCol ) { $ localPKCols [ ] = $ lPKCol -> getName ( ) ; } return count ( $ localPKCols ) === count ( $ this -> localColumns ) && ! array_diff ( $ localPKCols , $ this -> localColumns ) ; }
Returns whether or not this foreign key is also the primary key of the local table .
48,379
public function getOtherFks ( ) { $ fks = [ ] ; foreach ( $ this -> parentTable -> getForeignKeys ( ) as $ fk ) { if ( $ fk !== $ this ) { $ fks [ ] = $ fk ; } } return $ fks ; }
Returns the list of other foreign keys starting on the same table . Used in many - to - many relationships .
48,380
public function getForeignPrimaryKeys ( ) { $ lfmap = $ this -> getLocalForeignMapping ( ) ; $ foreignTable = $ this -> getForeignTable ( ) ; $ foreignPKCols = [ ] ; foreach ( $ foreignTable -> getPrimaryKey ( ) as $ fPKCol ) { $ foreignPKCols [ $ fPKCol -> getName ( ) ] = true ; } $ foreignCols = [ ] ; foreach ( $ thi...
Returns all foreign columns which are also a primary key of the foreign table .
48,381
public function getLocalPrimaryKeys ( ) { $ cols = [ ] ; $ localCols = $ this -> getLocalColumnObjects ( ) ; foreach ( $ localCols as $ localCol ) { if ( $ localCol -> isPrimaryKey ( ) ) { $ cols [ ] = $ localCol ; } } return $ cols ; }
Returns all local columns which are also a primary key of the local table .
48,382
public static function translateFieldName ( $ name , $ fromType , $ toType ) { $ toNames = static :: getFieldNames ( $ toType ) ; $ key = isset ( static :: $ fieldKeys [ $ fromType ] [ $ name ] ) ? static :: $ fieldKeys [ $ fromType ] [ $ name ] : null ; if ( null === $ key ) { throw new PropelException ( "'$name' coul...
Translates a fieldname to another type
48,383
public function setConfiguration ( $ profilerConfiguration ) { if ( isset ( $ profilerConfiguration [ 'slowTreshold' ] ) ) { $ this -> setSlowTreshold ( $ profilerConfiguration [ 'slowTreshold' ] ) ; } if ( isset ( $ profilerConfiguration [ 'details' ] ) ) { $ this -> setDetails ( $ profilerConfiguration [ 'details' ] ...
Configure the profiler from an array .
48,384
public function getProfileBetween ( $ startSnapshot , $ endSnapshot ) { $ profile = '' ; if ( $ this -> slowTreshold ) { if ( $ endSnapshot [ 'microtime' ] - $ startSnapshot [ 'microtime' ] >= $ this -> slowTreshold ) { $ profile .= 'SLOW ' ; } else { $ profile .= ' ' ; } } foreach ( $ this -> details as $ detailNa...
Returns a string that may be prepended to a log line containing debug information according to the current configuration .
48,385
public static function formatMemory ( $ bytes , $ precision = 3 ) { $ absBytes = abs ( $ bytes ) ; $ sign = ( $ bytes == $ absBytes ) ? 1 : - 1 ; $ suffix = [ 'B' , 'kB' , 'MB' , 'GB' , 'TB' , 'PB' , 'EB' , 'ZB' , 'YB' ] ; $ total = count ( $ suffix ) ; for ( $ i = 0 ; $ absBytes > 1024 && $ i < $ total ; $ i ++ ) { $ ...
Format a byte count into a human - readable representation .
48,386
public static function formatDuration ( $ duration , $ precision = 3 ) { if ( $ duration < 1 ) { $ duration *= 1000 ; $ unit = 'ms' ; } else { $ unit = 's ' ; } return self :: toPrecision ( $ duration , $ precision ) . $ unit ; }
Format a duration into a human - readable representation .
48,387
public static function convert ( $ c ) { $ runtimeVersion = Propel :: VERSION ; $ conf = '' ; $ conf .= "\$serviceContainer = \Propel\Runtime\Propel::getServiceContainer();" ; $ conf .= "\$serviceContainer->checkVersion('{$runtimeVersion}');" ; if ( isset ( $ c [ 'connections' ] ) ) { foreach ( $ c [ 'connections' ] as...
Create a PHP configuration from an array
48,388
public function findMethod ( $ methodName ) { if ( isset ( $ this -> knownMethodCache [ $ methodName ] ) ) { return $ this -> knownMethodCache [ $ methodName ] ; } $ tokens = token_get_all ( $ this -> code ) ; $ methodCode = '' ; $ isInFunction = false ; $ functionBracketBalance = 0 ; $ buffer = '' ; foreach ( $ tokens...
Parse the code looking for a method definition and returns the code if found
48,389
public function removeMethod ( $ methodName ) { if ( $ methodCode = $ this -> findMethod ( $ methodName ) ) { $ this -> code = str_replace ( $ methodCode , '' , $ this -> code ) ; $ this -> knownMethodCache [ $ methodName ] = false ; return $ methodCode ; } return false ; }
Parse the code looking for a method definition and removes the code if found
48,390
public function replaceMethod ( $ methodName , $ newCode ) { if ( $ methodCode = $ this -> findMethod ( $ methodName ) ) { $ this -> code = str_replace ( $ methodCode , $ newCode , $ this -> code ) ; $ this -> knownMethodCache [ $ methodName ] = $ newCode ; return $ methodCode ; } return false ; }
Parse the code looking for a method definition and replaces the code if found
48,391
public function addMethodAfter ( $ methodName , $ newCode ) { if ( $ methodCode = $ this -> findMethod ( $ methodName ) ) { $ this -> code = str_replace ( $ methodCode , $ methodCode . $ newCode , $ this -> code ) ; return $ methodCode ; } return false ; }
Parse the code looking for a method definition and adds the code after if found
48,392
public function fromArray ( $ array , $ rootKey = 'data' , $ charset = null ) { $ rootNode = $ this -> getRootNode ( $ rootKey ) ; $ this -> arrayToDOM ( $ array , $ rootNode , $ charset , false ) ; return $ rootNode -> ownerDocument -> saveXML ( ) ; }
Converts data from an associative array to XML .
48,393
public function getPluralizer ( ) { if ( ! isset ( $ this -> pluralizer ) ) { $ this -> pluralizer = $ this -> getGeneratorConfig ( ) -> getConfiguredPluralizer ( ) ; } return $ this -> pluralizer ; }
Returns new or existing Pluralizer class .
48,394
public function getStubObjectBuilder ( ) { if ( ! isset ( $ this -> stubObjectBuilder ) ) { $ this -> stubObjectBuilder = $ this -> getGeneratorConfig ( ) -> getConfiguredBuilder ( $ this -> getTable ( ) , 'objectstub' ) ; } return $ this -> stubObjectBuilder ; }
Returns new or existing stub Object builder class for this table .
48,395
public function getQueryBuilder ( ) { if ( ! isset ( $ this -> queryBuilder ) ) { $ this -> queryBuilder = $ this -> getGeneratorConfig ( ) -> getConfiguredBuilder ( $ this -> getTable ( ) , 'query' ) ; } return $ this -> queryBuilder ; }
Returns new or existing Query builder class for this table .
48,396
public function getStubQueryBuilder ( ) { if ( ! isset ( $ this -> stubQueryBuilder ) ) { $ this -> stubQueryBuilder = $ this -> getGeneratorConfig ( ) -> getConfiguredBuilder ( $ this -> getTable ( ) , 'querystub' ) ; } return $ this -> stubQueryBuilder ; }
Returns new or existing stub Query builder class for this table .
48,397
public function getInterfaceBuilder ( ) { if ( ! isset ( $ this -> interfaceBuilder ) ) { $ this -> interfaceBuilder = $ this -> getGeneratorConfig ( ) -> getConfiguredBuilder ( $ this -> getTable ( ) , 'interface' ) ; } return $ this -> interfaceBuilder ; }
Returns new or existing stub Interface builder class for this table .
48,398
public function getMultiExtendObjectBuilder ( ) { if ( ! isset ( $ this -> multiExtendObjectBuilder ) ) { $ this -> multiExtendObjectBuilder = $ this -> getGeneratorConfig ( ) -> getConfiguredBuilder ( $ this -> getTable ( ) , 'objectmultiextend' ) ; } return $ this -> multiExtendObjectBuilder ; }
Returns new or existing stub child object builder class for this table .
48,399
public function getNewBuilder ( Table $ table , $ classname ) { $ builder = new $ classname ( $ table ) ; $ builder -> setGeneratorConfig ( $ this ) ; return $ builder ; }
Gets a new data model builder class for specified table and classname .