idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
48,400
public function getNewStubQueryInheritanceBuilder ( Inheritance $ child ) { $ stubQueryInheritanceBuilder = $ this -> getGeneratorConfig ( ) -> getConfiguredBuilder ( $ this -> getTable ( ) , 'queryinheritancestub' ) ; $ stubQueryInheritanceBuilder -> setChild ( $ child ) ; return $ stubQueryInheritanceBuilder ; }
Returns new stub Query Inheritance builder class for this table .
48,401
public function toArray ( $ data , $ rootKey = null ) { $ data = Yaml :: parse ( $ data ) ; if ( $ rootKey === null ) { return $ data ; } if ( ! isset ( $ data [ $ rootKey ] ) ) { return [ ] ; } return $ data [ $ rootKey ] ; }
Converts data from YAML to an associative array .
48,402
public function parse ( Database $ database , array $ additionalTables = [ ] ) { $ tables = [ ] ; $ stmt = $ this -> dbh -> query ( "SELECT OBJECT_NAME FROM USER_OBJECTS WHERE OBJECT_TYPE = 'TABLE'" ) ; $ seqPattern = $ this -> getGeneratorConfig ( ) -> get ( ) [ 'database' ] [ 'adapters' ] [ 'oracle' ] [ 'autoincremen...
Searches for tables in the database . Maybe we want to search also the views .
48,403
protected function addIndexes ( Table $ table ) { $ stmt = $ this -> dbh -> query ( "SELECT INDEX_NAME, COLUMN_NAME FROM USER_IND_COLUMNS WHERE TABLE_NAME = '" . $ table -> getName ( ) . "' ORDER BY COLUMN_NAME" ) ; $ indices = [ ] ; while ( $ row = $ stmt -> fetch ( \ PDO :: FETCH_ASSOC ) ) { $ indices [ $ row [ 'INDE...
Adds Indexes to the specified table .
48,404
public function getMergedVendorInfo ( VendorInfo $ info ) { $ params = array_merge ( $ this -> parameters , $ info -> getParameters ( ) ) ; $ newInfo = new VendorInfo ( $ this -> type ) ; $ newInfo -> setParameters ( $ params ) ; return $ newInfo ; }
Returns a new VendorInfo object that combines two VendorInfo objects .
48,405
public static function executeString ( $ input , ConnectionInterface $ connection ) { return self :: executeStatements ( self :: parseString ( $ input ) , $ connection ) ; }
Execute a list of DDL statements based on a string Does not use transactions since they are not supported in DDL statements
48,406
public static function executeFile ( $ file , ConnectionInterface $ connection ) { return self :: executeStatements ( self :: parseFile ( $ file ) , $ connection ) ; }
Execute a list of DDL statements based on the path to the SQL file Does not use transactions since they are not supported in DDL statements
48,407
public function getNextStatement ( ) { $ isAfterBackslash = false ; $ isInString = false ; $ stringQuotes = '' ; $ parsedString = '' ; $ lowercaseString = '' ; while ( $ this -> pos <= $ this -> len ) { $ char = isset ( $ this -> sql [ $ this -> pos ] ) ? $ this -> sql [ $ this -> pos ] : '' ; switch ( $ char ) { case ...
Gets the next SQL statement in the inner SQL string and advances the cursor to the end of this statement .
48,408
public function setName ( $ name ) { $ this -> name = $ name ; if ( $ this -> id === null ) { $ this -> id = $ name ; } }
Sets the name of the Behavior
48,409
public function addParameter ( array $ parameter ) { $ parameter = array_change_key_case ( $ parameter , CASE_LOWER ) ; $ this -> parameters [ $ parameter [ 'name' ] ] = $ parameter [ 'value' ] ; }
Adds a single parameter .
48,410
public function modifyDatabase ( ) { foreach ( $ this -> getTables ( ) as $ table ) { if ( $ table -> hasBehavior ( $ this -> getId ( ) ) ) { continue ; } $ behavior = clone $ this ; $ table -> addBehavior ( $ behavior ) ; } }
This method is automatically called on database behaviors when the database model is finished .
48,411
public function addColumn ( $ name , $ phpName , $ type , $ isNotNull = false , $ size = null , $ defaultValue = null , $ pk = false , $ fkTable = null , $ fkColumn = null ) { $ col = new ColumnMap ( $ name , $ this ) ; $ col -> setType ( $ type ) ; $ col -> setSize ( $ size ) ; $ col -> setPhpName ( $ phpName ) ; $ co...
Add a column to the table .
48,412
public function addPrimaryKey ( $ columnName , $ phpName , $ type , $ isNotNull = false , $ size = null , $ defaultValue = null ) { return $ this -> addColumn ( $ columnName , $ phpName , $ type , $ isNotNull , $ size , $ defaultValue , true , null , null ) ; }
Add a primary key column to this Table .
48,413
public function addForeignKey ( $ columnName , $ phpName , $ type , $ fkTable , $ fkColumn , $ isNotNull = false , $ size = 0 , $ defaultValue = null ) { return $ this -> addColumn ( $ columnName , $ phpName , $ type , $ isNotNull , $ size , $ defaultValue , false , $ fkTable , $ fkColumn ) ; }
Add a foreign key column to the table .
48,414
public function getRelations ( ) { if ( ! $ this -> relationsBuilt ) { $ this -> buildRelations ( ) ; $ this -> relationsBuilt = true ; } return $ this -> relations ; }
Gets the RelationMap objects of the table This method will build the relations if they are not built yet
48,415
public function getUniqueDDL ( Unique $ unique ) { $ pattern = 'CONSTRAINT %s UNIQUE NONCLUSTERED (%s) ON [PRIMARY]' ; return sprintf ( $ pattern , $ this -> quoteIdentifier ( $ unique -> getName ( ) ) , $ this -> getColumnListDDL ( $ unique -> getColumnObjects ( ) ) ) ; }
Builds the DDL SQL for a Unique constraint object . MS SQL Server CONTRAINT specific
48,416
public function parse ( Database $ database , array $ additionalTables = [ ] ) { $ tableWraps = [ ] ; $ this -> parseTables ( $ tableWraps , $ database ) ; foreach ( $ additionalTables as $ table ) { $ this -> parseTables ( $ tableWraps , $ database , $ table ) ; } foreach ( $ tableWraps as $ wrap ) { $ this -> addColu...
Parses a database schema .
48,417
protected function addSequences ( Database $ database ) { $ searchPath = '?' ; $ params = [ $ database -> getSchema ( ) ] ; if ( ! $ database -> getSchema ( ) ) { $ stmt = $ this -> dbh -> query ( 'SHOW search_path' ) ; $ searchPathString = $ stmt -> fetchColumn ( ) ; $ params = [ ] ; $ searchPath = explode ( ',' , $ s...
Adds the sequences for this database .
48,418
public function getAdapterClass ( $ name = null ) { if ( null === $ name ) { $ name = $ this -> getDefaultDatasource ( ) ; } return $ this -> adapterClasses [ $ name ] ; }
Get the adapter class for a given datasource .
48,419
public function setAdapterClass ( $ name , $ adapterClass ) { $ this -> adapterClasses [ $ name ] = $ adapterClass ; unset ( $ this -> adapters [ $ name ] ) ; }
Set the adapter class for a given datasource .
48,420
public function getAdapter ( $ name = null ) { if ( null === $ name ) { $ name = $ this -> getDefaultDatasource ( ) ; } if ( ! isset ( $ this -> adapters [ $ name ] ) ) { if ( ! isset ( $ this -> adapterClasses [ $ name ] ) ) { throw new AdapterException ( sprintf ( 'No adapter class defined for datasource "%s"' , $ na...
Get the adapter for a given datasource .
48,421
public function setAdapter ( $ name , AdapterInterface $ adapter ) { $ this -> adapters [ $ name ] = $ adapter ; $ this -> adapterClasses [ $ name ] = get_class ( $ adapter ) ; }
Set the adapter for a given datasource .
48,422
public function setAdapters ( $ adapters ) { $ this -> adapterClasses = [ ] ; $ this -> adapters = [ ] ; foreach ( $ adapters as $ name => $ adapter ) { $ this -> setAdapter ( $ name , $ adapter ) ; } }
Reset existing adapters and set new adapters for all datasources .
48,423
public function checkVersion ( $ generatorVersion ) { if ( $ generatorVersion != Propel :: VERSION ) { $ warning = "Version mismatch: The generated model was build using propel '" . $ generatorVersion ; $ warning .= " while the current runtime is at version '" . Propel :: VERSION . "'" ; $ logger = $ this -> getLogger ...
check whether the given propel generator version has the same version as the propel runtime .
48,424
public function getDatabaseMap ( $ name = null ) { if ( null === $ name ) { $ name = $ this -> getDefaultDatasource ( ) ; } if ( ! isset ( $ this -> databaseMaps [ $ name ] ) ) { $ class = $ this -> databaseMapClass ; $ this -> databaseMaps [ $ name ] = new $ class ( $ name ) ; } return $ this -> databaseMaps [ $ name ...
Get the database map for a given datasource .
48,425
public function setConnection ( $ name , ConnectionInterface $ connection ) { $ manager = new ConnectionManagerSingle ( ) ; $ manager -> setConnection ( $ connection ) ; $ this -> setConnectionManager ( $ name , $ manager ) ; }
Shortcut to define a single connection for a datasource .
48,426
public function getProfiler ( ) { if ( null === $ this -> profiler ) { $ class = $ this -> profilerClass ; $ profiler = new $ class ( ) ; if ( ! empty ( $ this -> profilerConfiguration ) ) { $ profiler -> setConfiguration ( $ this -> profilerConfiguration ) ; } $ this -> profiler = $ profiler ; } return $ this -> profi...
Get a profiler instance .
48,427
public function getLogger ( $ name = 'defaultLogger' ) { if ( ! isset ( $ this -> loggers [ $ name ] ) ) { $ this -> loggers [ $ name ] = $ this -> buildLogger ( $ name ) ; } return $ this -> loggers [ $ name ] ; }
Get a logger instance
48,428
public function getName ( ) { $ this -> doNaming ( ) ; if ( $ this -> table && $ database = $ this -> table -> getDatabase ( ) ) { return substr ( $ this -> name , 0 , $ database -> getMaxColumnNameLength ( ) ) ; } return $ this -> name ; }
Returns the index name .
48,429
public function addColumn ( $ data ) { if ( $ data instanceof Column ) { $ column = $ data ; $ this -> columns [ ] = $ column -> getName ( ) ; if ( $ column -> getSize ( ) ) { $ this -> columnsSize [ $ column -> getName ( ) ] = $ column -> getSize ( ) ; } $ this -> columnObjects [ ] = $ column ; } else { $ this -> colu...
Adds a new column to the index .
48,430
public function getColumnSize ( $ name , $ caseInsensitive = false ) { if ( $ caseInsensitive ) { foreach ( $ this -> columnsSize as $ forName => $ size ) { if ( 0 === strcasecmp ( $ forName , $ name ) ) { return $ size ; } } return null ; } return isset ( $ this -> columnsSize [ $ name ] ) ? $ this -> columnsSize [ $ ...
Returns the size for the specified column .
48,431
public function hasColumnAtPosition ( $ pos , $ name , $ size = null , $ caseInsensitive = false ) { if ( ! isset ( $ this -> columns [ $ pos ] ) ) { return false ; } if ( $ caseInsensitive ) { $ test = 0 === strcasecmp ( $ this -> columns [ $ pos ] , $ name ) ; } else { $ test = $ this -> columns [ $ pos ] == $ name ;...
Returns whether or not this index has a given column at a given position .
48,432
public function setPhpName ( $ phpName = null ) { if ( null === $ phpName ) { $ this -> phpName = self :: generatePhpName ( $ this -> name , $ this -> phpNamingMethod , $ this -> namePrefix ) ; } else { $ this -> phpName = $ phpName ; } }
Sets the name to use in PHP sources .
48,433
public function setPhpSingularName ( $ phpSingularName = null ) { if ( null === $ phpSingularName ) { $ this -> phpSingularName = self :: generatePhpSingularName ( $ this -> getPhpName ( ) ) ; } else { $ this -> phpSingularName = $ phpSingularName ; } }
Sets the singular forn of the name to use in PHP sources .
48,434
public function getConstantName ( ) { if ( $ this -> getTableMapName ( ) ) { return self :: CONSTANT_PREFIX . strtoupper ( $ this -> getTableMapName ( ) ) ; } return self :: CONSTANT_PREFIX . strtoupper ( $ this -> getName ( ) ) ; }
Returns the column constant name .
48,435
public function addInheritance ( $ inheritance ) { if ( $ inheritance instanceof Inheritance ) { $ inheritance -> setColumn ( $ this ) ; if ( null === $ this -> inheritanceList ) { $ this -> inheritanceList = [ ] ; $ this -> isEnumeratedClasses = true ; } $ this -> inheritanceList [ ] = $ inheritance ; return $ inherit...
Adds a new inheritance definition to the inheritance list and sets the parent column of the inheritance to the current column .
48,436
public function hasReferrer ( ForeignKey $ fk ) { return $ this -> hasReferrers ( ) && in_array ( $ fk , $ this -> referrers , true ) ; }
Returns whether or not this column has a specific referrer for a specific foreign key object .
48,437
public function setType ( $ mappingType ) { $ this -> getDomain ( ) -> setType ( $ mappingType ) ; if ( in_array ( $ mappingType , [ PropelTypes :: VARBINARY , PropelTypes :: LONGVARBINARY , PropelTypes :: BLOB ] ) ) { $ this -> needsTransactionInPostgres = true ; } }
Sets the mapping column type .
48,438
public function setValueSet ( $ valueSet ) { if ( is_string ( $ valueSet ) ) { $ valueSet = explode ( ',' , $ valueSet ) ; $ valueSet = array_map ( 'trim' , $ valueSet ) ; } $ this -> valueSet = $ valueSet ; }
Sets the list of possible values for an ENUM or SET column .
48,439
public function getDefaultValueString ( ) { $ defaultValue = $ this -> getDefaultValue ( ) ; if ( null === $ defaultValue ) { return 'null' ; } if ( $ this -> isNumericType ( ) ) { return ( float ) $ defaultValue -> getValue ( ) ; } if ( $ this -> isTextType ( ) || $ this -> getDefaultValue ( ) -> isExpression ( ) ) { ...
Returns a string that will give this column a default value in PHP .
48,440
public function setDefaultValue ( $ defaultValue ) { if ( ! $ defaultValue instanceof ColumnDefaultValue ) { $ defaultValue = new ColumnDefaultValue ( $ defaultValue , ColumnDefaultValue :: TYPE_VALUE ) ; } $ this -> domain -> setDefaultValue ( $ defaultValue ) ; }
Sets a string that will give this column a default value .
48,441
public function getAutoIncrementString ( ) { if ( $ this -> isAutoIncrement ( ) && IdMethod :: NATIVE === $ this -> parentTable -> getIdMethod ( ) ) { return $ this -> getPlatform ( ) -> getAutoIncrement ( ) ; } if ( $ this -> isAutoIncrement ( ) ) { throw new EngineException ( sprintf ( 'You have specified autoIncreme...
Returns the auto - increment string .
48,442
public function hasPlatform ( ) { if ( null === $ this -> parentTable ) { return false ; } return $ this -> parentTable -> getPlatform ( ) ? true : false ; }
Returns whether or not this column has a platform adapter .
48,443
protected function appendPsForUniqueClauseTo ( & $ sb , array & $ params ) { if ( $ this -> ignoreStringCase ) { if ( $ this -> getAdapter ( ) instanceof PgsqlAdapter ) { $ this -> clause = preg_replace ( '/LIKE \?$/i' , 'ILIKE ?' , $ this -> clause ) ; } else { throw new InvalidClauseException ( 'Case insensitive LIKE...
Appends a Prepared Statement representation of the ModelCriterion onto the buffer Handles case insensitivity for VARCHAR columns
48,444
public function addTable ( $ tableName ) { $ this -> tables [ $ tableName ] = new TableMap ( $ tableName , $ this ) ; return $ this -> tables [ $ tableName ] ; }
Add a new table to the database by name .
48,445
public function hasTable ( $ name ) { if ( strpos ( $ name , '.' ) > 0 ) { $ name = substr ( $ name , 0 , strpos ( $ name , '.' ) ) ; } return isset ( $ this -> tables [ $ name ] ) ; }
Does this database contain this specific table?
48,446
public function load ( $ file , $ type = null ) { $ ini = parse_ini_file ( $ this -> getPath ( $ file ) , true , INI_SCANNER_RAW ) ; if ( false === $ ini ) { throw new InvalidArgumentException ( "The configuration file '$file' has invalid content." ) ; } $ ini = $ this -> parse ( $ ini ) ; $ ini = $ this -> resolvePara...
Loads a resource merge it with the default configuration array and resolve its parameters .
48,447
private function parseSection ( array $ section ) { $ config = [ ] ; foreach ( $ section as $ key => $ value ) { $ this -> parseKey ( $ key , $ value , $ config ) ; } return $ config ; }
Parse a section .
48,448
public function dump ( Database $ database ) { $ this -> appendDatabaseNode ( $ database , $ this -> document ) ; return trim ( $ this -> document -> saveXML ( ) ) ; }
Dumps a single Database model into an XML formatted version .
48,449
public function dumpSchema ( Schema $ schema , $ doFinalInitialization = true ) { $ rootNode = $ this -> document -> createElement ( 'app-data' ) ; $ this -> document -> appendChild ( $ rootNode ) ; foreach ( $ schema -> getDatabases ( $ doFinalInitialization ) as $ database ) { $ this -> appendDatabaseNode ( $ databas...
Dumps a single Schema model into an XML formatted version .
48,450
public static function convertToInt ( $ val , array $ valueSet ) { if ( $ val === null ) { return 0 ; } if ( ! is_array ( $ val ) ) { $ val = [ $ val ] ; } $ bitValueArr = array_pad ( [ ] , count ( $ valueSet ) , '0' ) ; foreach ( $ val as $ value ) { if ( ! in_array ( $ value , $ valueSet ) ) { throw new SetColumnConv...
Converts set column values to the corresponding integer .
48,451
public static function convertIntToArray ( $ val , array $ valueSet ) { if ( $ val === null ) { return [ ] ; } $ bitValueArr = array_reverse ( str_split ( base_convert ( $ val , 10 , 2 ) ) ) ; $ valueArr = [ ] ; foreach ( $ bitValueArr as $ bit => $ bitValue ) { if ( ! isset ( $ valueSet [ $ bit ] ) ) { throw new SetCo...
Converts set column integer value to corresponding array .
48,452
public function getId ( ConnectionInterface $ con , $ name = null ) { if ( null === $ name ) { throw new InvalidArgumentException ( "Unable to fetch next sequence ID without sequence name." ) ; } $ dataFetcher = $ con -> query ( sprintf ( 'SELECT nextval(%s)' , $ con -> quote ( $ name ) ) ) ; return $ dataFetcher -> fe...
Gets ID for specified sequence name .
48,453
public function getDatabase ( $ name = null , $ doFinalInitialization = true ) { if ( $ doFinalInitialization ) { $ this -> doFinalInitialization ( ) ; } if ( null === $ name ) { return $ this -> databases [ 0 ] ; } $ db = null ; foreach ( $ this -> databases as $ database ) { if ( $ database -> getName ( ) === $ name ...
Returns the database according to the specified name .
48,454
public function hasDatabase ( $ name ) { foreach ( $ this -> databases as $ database ) { if ( $ database -> getName ( ) === $ name ) { return true ; } } return false ; }
Returns whether or not a database with the specified name exists in this schema .
48,455
public function addDatabase ( $ database ) { if ( $ database instanceof Database ) { $ platform = null ; $ database -> setParentSchema ( $ this ) ; if ( null === $ database -> getPlatform ( ) ) { if ( $ config = $ this -> getGeneratorConfig ( ) ) { $ platform = $ config -> getConfiguredPlatform ( null , $ database -> g...
Adds a database to the list and sets the Schema property to this Schema . The database can be specified as a Database object or a DOMNode object .
48,456
public function doFinalInitialization ( ) { if ( ! $ this -> isInitialized ) { foreach ( $ this -> databases as $ database ) { $ database -> doFinalInitialization ( ) ; } $ this -> isInitialized = true ; } }
Finalizes the databases initialization .
48,457
public function joinSchemas ( array $ schemas ) { foreach ( $ schemas as $ schema ) { foreach ( $ schema -> getDatabases ( false ) as $ addDb ) { $ addDbName = $ addDb -> getName ( ) ; if ( $ this -> hasDatabase ( $ addDbName ) ) { $ db = $ this -> getDatabase ( $ addDbName , false ) ; $ namespace = $ db -> getNamespac...
Merge other Schema objects together into this Schema object .
48,458
public function countTables ( ) { $ nb = 0 ; foreach ( $ this -> getDatabases ( ) as $ database ) { $ nb += $ database -> countTables ( ) ; } return $ nb ; }
Returns the number of tables in all the databases of this Schema object .
48,459
public function getRenameTableDDL ( $ fromTableName , $ toTableName ) { $ pattern = "RENAME TABLE %s TO %s;" ; return sprintf ( $ pattern , $ this -> quoteIdentifier ( $ fromTableName ) , $ this -> quoteIdentifier ( $ toTableName ) ) ; }
Builds the DDL SQL to rename a table
48,460
public function getAddColumnsDDL ( $ columns ) { $ lines = '' ; foreach ( $ columns as $ column ) { $ lines .= $ this -> getAddColumnDDL ( $ column ) ; } return $ lines ; }
Builds the DDL SQL to add a list of columns
48,461
public function modifyTable ( ) { $ table = $ this -> getTable ( ) ; if ( ! $ table -> hasColumn ( $ this -> getParameter ( 'slug_column' ) ) ) { $ table -> addColumn ( [ 'name' => $ this -> getParameter ( 'slug_column' ) , 'type' => 'VARCHAR' , 'size' => 255 , 'required' => false , ] ) ; if ( 'true' === $ this -> getP...
Adds the slug_column to the current table .
48,462
protected function addUniqueConstraint ( Table $ table ) { $ unique = new Unique ( $ this -> getColumnForParameter ( 'slug_column' ) ) ; $ unique -> setName ( $ table -> getCommonName ( ) . '_slug' ) ; $ unique -> addColumn ( $ table -> getColumn ( $ this -> getParameter ( 'slug_column' ) ) ) ; if ( $ this -> getParame...
Adds a unique constraint to the table to enforce uniqueness of the slug_column
48,463
public static function createHighPrecision ( $ time = null ) { $ dateTime = \ DateTime :: createFromFormat ( 'U.u' , $ time ? : self :: getMicrotime ( ) ) ; $ dateTime -> setTimeZone ( new \ DateTimeZone ( date_default_timezone_get ( ) ) ) ; return $ dateTime ; }
Creates a new DateTime object with milliseconds resolution .
48,464
public function parseFile ( $ xmlFile ) { if ( $ this -> isAlreadyParsed ( $ xmlFile ) ) { return ; } return $ this -> parseString ( file_get_contents ( $ xmlFile ) , $ xmlFile ) ; }
Parses a XML input file and returns a newly created and populated Schema structure .
48,465
public function parseString ( $ xmlString , $ xmlFile = null ) { if ( $ this -> isAlreadyParsed ( $ xmlFile ) ) { return ; } $ this -> schemasTagsStack [ $ xmlFile ] = [ ] ; $ this -> currentXmlFile = $ xmlFile ; $ parser = xml_parser_create ( ) ; xml_parser_set_option ( $ parser , XML_OPTION_CASE_FOLDING , 0 ) ; xml_s...
Parses a XML input string and returns a newly created and populated Schema structure .
48,466
public function getTableNameAndAlias ( $ tableAliasOrName ) { if ( isset ( $ this -> aliases [ $ tableAliasOrName ] ) ) { return [ $ this -> aliases [ $ tableAliasOrName ] , $ tableAliasOrName ] ; } return [ $ tableAliasOrName , null ] ; }
Returns the table name and alias based on a table alias or name . Use this method to get the details of a table name that comes in a clause which can be either a table name or an alias name .
48,467
public function getNewCriterion ( $ column , $ value = null , $ comparison = self :: EQUAL ) { if ( is_int ( $ comparison ) ) { return new RawCriterion ( $ this , $ column , $ value , $ comparison ) ; } switch ( $ comparison ) { case Criteria :: CUSTOM : return new CustomCriterion ( $ this , $ value ) ; case Criteria :...
Method to return a Criterion that is not added automatically to this Criteria . This can be used to chain the Criterions to form a more complex where clause .
48,468
public function getComparison ( $ key ) { if ( isset ( $ this -> map [ $ key ] ) ) { return $ this -> map [ $ key ] -> getComparison ( ) ; } return null ; }
Method to return a comparison String .
48,469
public function getValue ( $ name ) { if ( isset ( $ this -> map [ $ name ] ) ) { return $ this -> map [ $ name ] -> getValue ( ) ; } return null ; }
Method to return the value that was added to Criteria .
48,470
public function setAll ( ) { $ this -> removeSelectModifier ( self :: DISTINCT ) ; $ this -> addSelectModifier ( self :: ALL ) ; return $ this ; }
Adds ALL modifier to the SQL statement .
48,471
public function setDistinct ( ) { $ this -> removeSelectModifier ( self :: ALL ) ; $ this -> addSelectModifier ( self :: DISTINCT ) ; return $ this ; }
Adds DISTINCT modifier to the SQL statement .
48,472
public function remove ( $ key ) { if ( ! isset ( $ this -> map [ $ key ] ) ) { return null ; } $ removed = $ this -> map [ $ key ] ; unset ( $ this -> map [ $ key ] ) ; if ( $ removed instanceof AbstractCriterion ) { return $ removed -> getValue ( ) ; } return $ removed ; }
Remove an object from the criteria .
48,473
public function toString ( ) { $ sb = 'Criteria:' ; try { $ params = [ ] ; $ sb .= "\nSQL (may not be complete): " . $ this -> createSelectSql ( $ params ) ; $ sb .= "\nParams: " ; $ paramstr = [ ] ; foreach ( $ params as $ param ) { $ paramstr [ ] = $ param [ 'table' ] . '.' . $ param [ 'column' ] . ' => ' . var_expor...
Build a string representation of the Criteria .
48,474
public function addOr ( $ p1 , $ p2 = null , $ p3 = null , $ preferColumnCondition = true ) { $ rightCriterion = $ this -> getCriterionForCondition ( $ p1 , $ p2 , $ p3 ) ; $ leftCriterion = $ this -> getLastCriterion ( ) ; if ( null !== $ leftCriterion ) { $ leftCriterion -> addOr ( $ rightCriterion ) ; } else { $ thi...
If a prior criterion exists the condition is OR ed to it . If no criterion exist the condition is added a new criterion
48,475
public function _if ( $ cond ) { $ this -> conditionalProxy = new PropelConditionalProxy ( $ this , $ cond , $ this -> conditionalProxy ) ; return $ this -> conditionalProxy -> getCriteriaOrProxy ( ) ; }
Returns the current object if the condition is true or a PropelConditionalProxy instance otherwise . Allows for conditional statements in a fluid interface .
48,476
public function _elseif ( $ cond ) { if ( ! $ this -> conditionalProxy ) { throw new LogicException ( __METHOD__ . ' must be called after _if()' ) ; } return $ this -> conditionalProxy -> _elseif ( $ cond ) ; }
Returns a PropelConditionalProxy instance . Allows for conditional statements in a fluid interface .
48,477
public function setDefaultStringFormat ( $ format ) { $ formats = static :: getSupportedStringFormats ( ) ; $ format = strtoupper ( $ format ) ; if ( ! in_array ( $ format , $ formats ) ) { throw new InvalidArgumentException ( sprintf ( 'Given "%s" default string format is not supported. Only "%s" are valid string form...
Sets the default string format for ActiveRecord objects in this table . This parameter can be overridden at the table level .
48,478
public function countTables ( ) { $ count = 0 ; foreach ( $ this -> tables as $ table ) { if ( ! $ table -> isReadOnly ( ) ) { $ count ++ ; } } return $ count ; }
Return the number of tables in the database .
48,479
public function getTablesForSql ( ) { $ tables = [ ] ; foreach ( $ this -> tables as $ table ) { if ( ! $ table -> isSkipSql ( ) ) { $ tables [ ] = $ table ; } } return $ tables ; }
Returns the list of all tables that have a SQL representation .
48,480
public function hasTable ( $ name , $ caseInsensitive = false ) { if ( $ caseInsensitive ) { return isset ( $ this -> tablesByLowercaseName [ strtolower ( $ name ) ] ) ; } return isset ( $ this -> tablesByName [ $ name ] ) ; }
Returns whether or not the database has a table .
48,481
public function getTable ( $ name , $ caseInsensitive = false ) { if ( $ this -> getSchema ( ) && $ this -> getPlatform ( ) -> supportsSchemas ( ) && false === strpos ( $ name , $ this -> getPlatform ( ) -> getSchemaDelimiter ( ) ) ) { $ name = $ this -> getSchema ( ) . $ this -> getPlatform ( ) -> getSchemaDelimiter (...
Returns the table with the specified name .
48,482
public function getTableByPhpName ( $ phpName ) { if ( isset ( $ this -> tablesByPhpName [ $ phpName ] ) ) { return $ this -> tablesByPhpName [ $ phpName ] ; } return null ; }
Returns the table object with the specified PHP name .
48,483
public function addTable ( $ table ) { if ( ! $ table instanceof Table ) { $ tbl = new Table ( ) ; $ tbl -> setDatabase ( $ this ) ; $ tbl -> loadMapping ( $ table ) ; return $ this -> addTable ( $ tbl ) ; } $ table -> setDatabase ( $ this ) ; if ( isset ( $ this -> tablesByName [ $ table -> getName ( ) ] ) ) { throw n...
Adds a new table to this database .
48,484
public function setSchema ( $ schema ) { $ oldSchema = $ this -> schema ; if ( $ this -> schema !== $ schema && $ this -> getPlatform ( ) ) { $ schemaDelimiter = $ this -> getPlatform ( ) -> getSchemaDelimiter ( ) ; $ fixHash = function ( & $ array ) use ( $ schema , $ oldSchema , $ schemaDelimiter ) { foreach ( $ arra...
Sets the database s schema .
48,485
private function computeTableNamespace ( Table $ table ) { $ namespace = $ table -> getNamespace ( ) ; if ( $ this -> isAbsoluteNamespace ( $ namespace ) ) { $ namespace = ltrim ( $ namespace , '\\' ) ; $ table -> setNamespace ( $ namespace ) ; return $ namespace ; } if ( $ namespace = $ this -> getNamespace ( ) ) { if...
Computes the table namespace based on the current relative or absolute table namespace and the database namespace .
48,486
public function getDomain ( $ name ) { if ( isset ( $ this -> domainMap [ $ name ] ) ) { return $ this -> domainMap [ $ name ] ; } return null ; }
Returns the already configured domain object by its name .
48,487
public function getNextTableBehavior ( ) { $ behaviors = [ ] ; $ nextBehavior = null ; foreach ( $ this -> tables as $ table ) { foreach ( $ table -> getBehaviors ( ) as $ behavior ) { if ( ! $ behavior -> isTableModified ( ) ) { $ behaviors [ $ behavior -> getTableModificationOrder ( ) ] [ ] = $ behavior ; } } } ksort...
Returns the next behavior on all tables ordered by behavior priority and skipping the ones that were already executed .
48,488
public function doFinalInitialization ( ) { $ this -> setupTableReferrers ( ) ; foreach ( $ this -> getBehaviors ( ) as $ behavior ) { $ behavior -> modifyDatabase ( ) ; } while ( $ behavior = $ this -> getNextTableBehavior ( ) ) { $ behavior -> getTableModifier ( ) -> modifyTable ( ) ; $ behavior -> setTableModified (...
Finalizes the setup process .
48,489
public function objectMethods ( $ builder ) { $ array = $ this -> getParameters ( ) ; if ( empty ( $ array ) ) { throw new InvalidArgumentException ( 'Please, define your rules for validation.' ) ; } $ this -> cleanupParameters ( ) ; $ this -> builder = $ builder ; $ this -> builder -> declareClasses ( 'Symfony\\Compon...
Add behavior methods to model class
48,490
public function getParametersFromColumnName ( $ columnName = null ) { $ array = [ ] ; if ( null !== $ columnName ) { $ this -> cleanupParameters ( ) ; foreach ( $ this -> getParameters ( ) as $ key => $ parameter ) { if ( $ parameter [ 'column' ] === $ columnName ) { $ array [ $ key ] = $ parameter ; } } } return $ arr...
Returns the parameters associated with a given column . Useful for i18n behavior
48,491
public function removeParametersFromColumnName ( $ columnName = null ) { if ( null !== $ columnName ) { $ newParams = [ ] ; $ parameters = $ this -> getParameters ( ) ; foreach ( $ parameters as $ key => $ parameter ) { if ( $ parameter [ 'column' ] != $ columnName ) { $ newParams [ $ key ] = $ parameter ; } } $ this -...
Remove parameters associated with given column . Useful for i18n behavior
48,492
protected function cleanupParameters ( ) { $ parser = new Parser ( ) ; $ params = $ this -> getParameters ( ) ; foreach ( $ params as $ key => $ value ) { if ( is_string ( $ value ) ) { $ params [ $ key ] = $ parser -> parse ( $ value ) ; } } $ this -> setParameters ( $ params ) ; }
Convert those parameters containing an array in YAML format into a php array
48,493
public function getConnection ( $ conparams ) { $ conparams = $ this -> prepareParams ( $ conparams ) ; if ( ! isset ( $ conparams [ 'dsn' ] ) ) { throw new InvalidArgumentException ( 'No dsn specified in your connection parameters' ) ; } $ dsn = $ conparams [ 'dsn' ] ; $ user = isset ( $ conparams [ 'user' ] ) ? $ con...
Build database connection
48,494
public function quote ( $ text ) { if ( false !== ( $ pos = strrpos ( $ text , '.' ) ) ) { $ table = substr ( $ text , 0 , $ pos ) ; $ column = substr ( $ text , $ pos + 1 ) ; } else { $ table = '' ; $ column = $ text ; } if ( $ table ) { return $ this -> quoteIdentifierTable ( $ table ) . '.' . $ this -> quoteIdentifi...
Quotes full qualified column names and table names .
48,495
public function formatTemporalValue ( $ value , ColumnMap $ cMap ) { if ( $ dt = PropelDateTime :: newInstance ( $ value ) ) { switch ( $ cMap -> getType ( ) ) { case PropelTypes :: TIMESTAMP : case PropelTypes :: BU_TIMESTAMP : $ value = $ dt -> format ( $ this -> getTimestampFormatter ( ) ) ; break ; case PropelTypes...
Formats a temporal value before binding given a ColumnMap object
48,496
public function getPlainSelectedColumns ( Criteria $ criteria ) { $ selected = [ ] ; foreach ( $ criteria -> getSelectColumns ( ) as $ columnName ) { if ( false === strpos ( $ columnName , '(' ) ) { $ selected [ ] = $ columnName ; } } foreach ( $ criteria -> getAsColumns ( ) as $ alias => $ col ) { if ( false === strpo...
Returns all selected columns that are selected without a aggregate function .
48,497
public function turnSelectColumnsToAliases ( Criteria $ criteria ) { $ selectColumns = $ criteria -> getSelectColumns ( ) ; $ asColumns = $ criteria -> getAsColumns ( ) ; $ criteria -> clearSelectColumns ( ) ; $ columnAliases = $ asColumns ; foreach ( $ selectColumns as $ clause ) { $ baseAlias = preg_replace ( '/\W/' ...
Ensures uniqueness of select column names by turning them all into aliases This is necessary for queries on more than one table when the tables share a column name
48,498
public function bindValues ( \ PDOStatement $ stmt , array $ params , DatabaseMap $ dbMap ) { $ position = 0 ; foreach ( $ params as $ param ) { $ position ++ ; $ parameter = ':p' . $ position ; $ value = $ param [ 'value' ] ; if ( null === $ value ) { $ stmt -> bindValue ( $ parameter , null , \ PDO :: PARAM_NULL ) ; ...
Binds values in a prepared statement .
48,499
public function bindValue ( \ PDOStatement $ stmt , $ parameter , $ value , ColumnMap $ cMap , $ position = null ) { if ( $ cMap -> isTemporal ( ) ) { $ value = $ this -> formatTemporalValue ( $ value , $ cMap ) ; } elseif ( is_resource ( $ value ) && $ cMap -> isLob ( ) ) { rewind ( $ value ) ; } return $ stmt -> bind...
Binds a value to a positioned parameter in a statement given a ColumnMap object to infer the binding type .