idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
48,200 | public function addBehavior ( $ bdata ) { if ( $ bdata instanceof Behavior ) { $ behavior = $ bdata ; if ( $ this -> hasBehavior ( $ behavior -> getId ( ) ) && $ behavior -> allowMultiple ( ) ) { if ( $ behavior -> getId ( ) === $ behavior -> getName ( ) ) { throw new BuildException ( sprintf ( 'Behavior "%s" is alread... | Adds a new Behavior |
48,201 | public static function convert ( $ xmlToParse ) { if ( ! is_string ( $ xmlToParse ) ) { throw new InvalidArgumentException ( "XmlToArrayConverter::convert method expects an xml file to parse, or a string containing valid xml" ) ; } $ isFile = file_exists ( $ xmlToParse ) ; if ( ( $ isFile && 0 === filesize ( $ xmlToPar... | Create a PHP array from the XML file |
48,202 | public static function computeDiff ( Table $ fromTable , Table $ toTable , $ caseInsensitive = false ) { $ tc = new self ( ) ; $ tc -> setFromTable ( $ fromTable ) ; $ tc -> setToTable ( $ toTable ) ; $ differences = 0 ; $ differences += $ tc -> compareColumns ( $ caseInsensitive ) ; $ differences += $ tc -> comparePri... | Returns the computed difference between two table objects . |
48,203 | public function getSymmetricalRelation ( ) { $ localMapping = [ $ this -> getLeftColumns ( ) , $ this -> getRightColumns ( ) ] ; foreach ( $ this -> getRightTable ( ) -> getRelations ( ) as $ relation ) { if ( $ localMapping == [ $ relation -> getRightColumns ( ) , $ relation -> getLeftColumns ( ) ] ) { return $ relati... | Gets the symmetrical relation |
48,204 | protected function getMappedPropelType ( $ nativeType ) { if ( null === $ this -> nativeToPropelTypeMap ) { $ this -> nativeToPropelTypeMap = $ this -> getTypeMapping ( ) ; } if ( isset ( $ this -> nativeToPropelTypeMap [ $ nativeType ] ) ) { return $ this -> nativeToPropelTypeMap [ $ nativeType ] ; } return null ; } | Gets a mapped Propel type for specified native type . |
48,205 | protected function getMappedNativeType ( $ propelType ) { if ( null === $ this -> reverseTypeMap ) { $ this -> reverseTypeMap = array_flip ( $ this -> getTypeMapping ( ) ) ; } return isset ( $ this -> reverseTypeMap [ $ propelType ] ) ? $ this -> reverseTypeMap [ $ propelType ] : null ; } | Give a best guess at the native type . |
48,206 | protected function getNewVendorInfoObject ( array $ params ) { $ type = $ this -> getPlatform ( ) -> getDatabaseType ( ) ; $ vi = new VendorInfo ( $ type ) ; $ vi -> setParameters ( $ params ) ; return $ vi ; } | Gets a new VendorInfo object for this platform with specified params . |
48,207 | public function getPlatform ( ) { if ( null === $ this -> platform ) { $ this -> platform = $ this -> getGeneratorConfig ( ) -> getConfiguredPlatform ( ) ; } return $ this -> platform ; } | Returns the database s platform . |
48,208 | public function toKeyValue ( $ keyColumn = 'PrimaryKey' , $ valueColumn = null ) { $ ret = [ ] ; $ keyGetterMethod = 'get' . $ keyColumn ; $ valueGetterMethod = ( null === $ valueColumn ) ? '__toString' : ( 'get' . $ valueColumn ) ; foreach ( $ this as $ obj ) { $ ret [ $ obj -> $ keyGetterMethod ( ) ] = $ obj -> $ val... | Get an associative array representation of the collection The first parameter specifies the column to be used for the key And the second for the value . |
48,209 | public function toKeyIndex ( $ keyColumn = 'PrimaryKey' ) { $ ret = [ ] ; $ keyGetterMethod = 'get' . ucfirst ( $ keyColumn ) ; foreach ( $ this as $ obj ) { $ ret [ $ obj -> $ keyGetterMethod ( ) ] = $ obj ; } return $ ret ; } | Get an associative array representation of the collection . The first parameter specifies the column to be used for the key . |
48,210 | public function getColumnValues ( $ columnName = 'PrimaryKey' ) { $ ret = [ ] ; $ keyGetterMethod = 'get' . ucfirst ( $ columnName ) ; foreach ( $ this as $ obj ) { $ ret [ ] = $ obj -> $ keyGetterMethod ( ) ; } return $ ret ; } | Get an array representation of the column . |
48,211 | public function setNamespace ( $ namespace ) { $ namespace = rtrim ( trim ( $ namespace ) , '\\' ) ; if ( $ namespace === $ this -> namespace ) { return ; } $ this -> namespace = $ namespace ; if ( $ namespace && ( ! $ this -> package || $ this -> packageOverridden ) && $ this -> getBuildProperty ( 'generator.namespace... | Sets the namespace . |
48,212 | public function setPackage ( $ package ) { if ( $ package === $ this -> package ) { return ; } $ this -> package = $ package ; $ this -> packageOverridden = false ; } | Sets the package name . |
48,213 | public function setSchema ( $ schema ) { if ( $ schema === $ this -> schema ) { return ; } $ this -> schema = $ schema ; if ( $ schema && ! $ this -> package && $ this -> getBuildProperty ( 'schemaAutoPackage' ) ) { $ this -> package = $ schema ; $ this -> packageOverridden = true ; } if ( $ schema && ! $ this -> names... | Sets the schema name . |
48,214 | public function load ( $ file , $ type = null ) { $ json = file_get_contents ( $ this -> getPath ( $ file ) ) ; $ content = [ ] ; if ( '' !== $ json ) { $ content = json_decode ( $ json , true ) ; $ error = json_last_error ( ) ; if ( JSON_ERROR_NONE !== $ error ) { throw new JsonParseException ( $ error ) ; } } $ conte... | Loads an Json file . |
48,215 | protected function getCollection ( ) { $ collection = [ ] ; $ class = $ this -> getCollectionClassName ( ) ; if ( $ class ) { $ collection = new $ class ( ) ; $ collection -> setModel ( $ this -> class ) ; $ collection -> setFormatter ( $ this ) ; } return $ collection ; } | Returns a Collection object or a simple array . |
48,216 | public function setAddedColumns ( array $ columns ) { $ this -> addedColumns = [ ] ; foreach ( $ columns as $ column ) { $ this -> addAddedColumn ( $ column -> getName ( ) , $ column ) ; } } | Sets the added columns . |
48,217 | public function setRemovedColumns ( array $ removedColumns ) { $ this -> removedColumns = [ ] ; foreach ( $ removedColumns as $ removedColumn ) { $ this -> addRemovedColumn ( $ removedColumn -> getName ( ) , $ removedColumn ) ; } } | Setter for the removedColumns property |
48,218 | public function setModifiedColumns ( array $ modifiedColumns ) { $ this -> modifiedColumns = [ ] ; foreach ( $ modifiedColumns as $ columnName => $ modifiedColumn ) { $ this -> addModifiedColumn ( $ columnName , $ modifiedColumn ) ; } } | Sets the list of modified columns . |
48,219 | public function setRenamedColumns ( array $ renamedColumns ) { $ this -> renamedColumns = [ ] ; foreach ( $ renamedColumns as $ columns ) { list ( $ fromColumn , $ toColumn ) = $ columns ; $ this -> addRenamedColumn ( $ fromColumn , $ toColumn ) ; } } | Sets the list of renamed columns . |
48,220 | public function setAddedPkColumns ( array $ addedPkColumns ) { $ this -> addedPkColumns = [ ] ; foreach ( $ addedPkColumns as $ addedPkColumn ) { $ this -> addAddedPkColumn ( $ addedPkColumn -> getName ( ) , $ addedPkColumn ) ; } } | Sets the list of added primary key columns . |
48,221 | public function addAddedPkColumn ( $ columnName , Column $ addedPkColumn ) { if ( ! $ addedPkColumn -> isPrimaryKey ( ) ) { throw new DiffException ( sprintf ( 'Column %s is not a valid primary key column.' , $ columnName ) ) ; } $ this -> addedPkColumns [ $ columnName ] = $ addedPkColumn ; } | Add an added Pk column |
48,222 | public function setRemovedPkColumns ( array $ removedPkColumns ) { $ this -> removedPkColumns = [ ] ; foreach ( $ removedPkColumns as $ removedPkColumn ) { $ this -> addRemovedPkColumn ( $ removedPkColumn -> getName ( ) , $ removedPkColumn ) ; } } | Sets the list of removed primary key columns . |
48,223 | public function setRenamedPkColumns ( array $ renamedPkColumns ) { $ this -> renamedPkColumns = [ ] ; foreach ( $ renamedPkColumns as $ columns ) { list ( $ fromColumn , $ toColumn ) = $ columns ; $ this -> addRenamedPkColumn ( $ fromColumn , $ toColumn ) ; } } | Sets the list of all renamed primary key columns . |
48,224 | public function setAddedIndices ( array $ addedIndices ) { $ this -> addedIndices = [ ] ; foreach ( $ addedIndices as $ addedIndex ) { $ this -> addAddedIndex ( $ addedIndex -> getName ( ) , $ addedIndex ) ; } } | Sets the list of new added indices . |
48,225 | public function setRemovedIndices ( array $ removedIndices ) { $ this -> removedIndices = [ ] ; foreach ( $ removedIndices as $ removedIndex ) { $ this -> addRemovedIndex ( $ removedIndex -> getName ( ) , $ removedIndex ) ; } } | Sets the list of removed indices . |
48,226 | public function setModifiedIndices ( array $ modifiedIndices ) { $ this -> modifiedIndices = [ ] ; foreach ( $ modifiedIndices as $ indices ) { list ( $ fromIndex , $ toIndex ) = $ indices ; $ this -> addModifiedIndex ( $ fromIndex -> getName ( ) , $ fromIndex , $ toIndex ) ; } } | Sets the list of modified indices . |
48,227 | public function setAddedFks ( array $ addedFks ) { $ this -> addedFks = [ ] ; foreach ( $ addedFks as $ addedFk ) { $ this -> addAddedFk ( $ addedFk -> getName ( ) , $ addedFk ) ; } } | Sets the list of added foreign keys . |
48,228 | public function setRemovedFks ( array $ removedFks ) { $ this -> removedFks = [ ] ; foreach ( $ removedFks as $ removedFk ) { $ this -> addRemovedFk ( $ removedFk -> getName ( ) , $ removedFk ) ; } } | Sets the list of removed foreign keys . |
48,229 | public function setModifiedFks ( array $ modifiedFks ) { $ this -> modifiedFks = [ ] ; foreach ( $ modifiedFks as $ foreignKeys ) { list ( $ fromForeignKey , $ toForeignKey ) = $ foreignKeys ; $ this -> addModifiedFk ( $ fromForeignKey -> getName ( ) , $ fromForeignKey , $ toForeignKey ) ; } } | Sets the list of modified foreign keys . |
48,230 | public function addModifiedFk ( $ fkName , ForeignKey $ fromFk , ForeignKey $ toFk ) { $ this -> modifiedFks [ $ fkName ] = [ $ fromFk , $ toFk ] ; } | Adds a modified foreign key . |
48,231 | protected function addHookMethods ( & $ script ) { $ hooks = [ ] ; foreach ( [ 'pre' , 'post' ] as $ hook ) { foreach ( [ 'Insert' , 'Update' , 'Save' , 'Delete' ] as $ action ) { $ hooks [ $ hook . $ action ] = false === strpos ( $ script , "function $hook.$action(" ) ; } } $ script .= $ this -> renderTemplate ( 'base... | Adds the base object hook functions . |
48,232 | protected function addApplyDefaultValuesBody ( & $ script ) { $ table = $ this -> getTable ( ) ; $ colsWithDefaults = [ ] ; foreach ( $ table -> getColumns ( ) as $ column ) { $ def = $ column -> getDefaultValue ( ) ; if ( $ def !== null && ! $ def -> isExpression ( ) ) { $ colsWithDefaults [ ] = $ column ; } } foreach... | Adds the function body of the applyDefault method . |
48,233 | public function addTemporalAccessorComment ( & $ script , Column $ column ) { $ clo = $ column -> getLowercasedName ( ) ; $ dateTimeClass = $ this -> getDateTimeClass ( $ column ) ; $ handleMysqlDate = false ; if ( $ this -> getPlatform ( ) instanceof MysqlPlatform ) { if ( $ column -> getType ( ) === PropelTypes :: TI... | Adds the comment for a temporal accessor . |
48,234 | public function addTemporalAccessorOpen ( & $ script , Column $ column ) { $ cfc = $ column -> getPhpName ( ) ; $ defaultfmt = null ; $ visibility = $ column -> getAccessorVisibility ( ) ; if ( $ column -> getType ( ) === PropelTypes :: DATE ) { $ defaultfmt = $ this -> getBuildProperty ( 'generator.dateTime.defaultDat... | Adds the function declaration for a temporal accessor . |
48,235 | protected function getAccessorLazyLoadSnippet ( Column $ column ) { if ( $ column -> isLazyLoad ( ) ) { $ clo = $ column -> getLowercasedName ( ) ; $ defaultValueString = 'null' ; $ def = $ column -> getDefaultValue ( ) ; if ( $ def !== null && ! $ def -> isExpression ( ) ) { $ defaultValueString = $ this -> getDefault... | Gets accessor lazy loaded snippets . |
48,236 | protected function addTemporalAccessorBody ( & $ script , Column $ column ) { $ clo = $ column -> getLowercasedName ( ) ; $ dateTimeClass = $ this -> getDateTimeClass ( $ column ) ; $ this -> declareClasses ( $ dateTimeClass ) ; $ defaultfmt = null ; if ( $ column -> getType ( ) === PropelTypes :: DATE ) { $ defaultfmt... | Adds the body of the temporal accessor . |
48,237 | public function addJsonAccessorOpen ( & $ script , Column $ column ) { $ cfc = $ column -> getPhpName ( ) ; $ visibility = $ column -> getAccessorVisibility ( ) ; $ script .= " " . $ visibility . " function get$cfc(\$asArray = true" ; if ( $ column -> isLazyLoad ( ) ) { $ script .= ", ConnectionInterface \$con = nul... | Adds the function declaration for a JSON accessor . |
48,238 | protected function addArrayAccessorBody ( & $ script , Column $ column ) { $ clo = $ column -> getLowercasedName ( ) ; $ cloUnserialized = $ clo . '_unserialized' ; if ( $ column -> isLazyLoad ( ) ) { $ script .= $ this -> getAccessorLazyLoadSnippet ( $ column ) ; } $ script .= " if (null === \$this->$cloUnseria... | Adds the function body for an array accessor method . |
48,239 | protected function addBooleanAccessor ( & $ script , Column $ column ) { $ name = self :: getBooleanAccessorName ( $ column ) ; if ( in_array ( $ name , ClassTools :: getPropelReservedMethods ( ) ) ) { return ; } $ this -> addDefaultAccessorComment ( $ script , $ column ) ; $ this -> addBooleanAccessorOpen ( $ script ,... | Adds a boolean isser method . |
48,240 | protected static function getBooleanAccessorName ( Column $ column ) { $ name = $ column -> getCamelCaseName ( ) ; if ( ! preg_match ( '/^(?:is|has)(?=[A-Z])/' , $ name ) ) { $ name = 'is' . ucfirst ( $ name ) ; } return $ name ; } | Returns the name to be used as boolean accessor name |
48,241 | public function addBooleanAccessorOpen ( & $ script , Column $ column ) { $ name = self :: getBooleanAccessorName ( $ column ) ; $ visibility = $ column -> getAccessorVisibility ( ) ; $ script .= " " . $ visibility . " function $name(" ; if ( $ column -> isLazyLoad ( ) ) { $ script .= "ConnectionInterface \$con = nu... | Adds the function declaration for a boolean accessor . |
48,242 | protected function addBooleanAccessorBody ( & $ script , Column $ column ) { $ cfc = $ column -> getPhpName ( ) ; $ script .= " return \$this->get$cfc(" ; if ( $ column -> isLazyLoad ( ) ) { $ script .= '$con' ; } $ script .= ");" ; } | Adds the function body for a boolean accessor method . |
48,243 | public function addEnumAccessorComment ( & $ script , Column $ column ) { $ clo = $ column -> getLowercasedName ( ) ; $ script .= " /** * Get the [$clo] column value. * " . $ column -> getDescription ( ) ; if ( $ column -> isLazyLoad ( ) ) { $ script .= " * @param ConnectionInterface An optional Con... | Add the comment for an enum accessor method . |
48,244 | protected function addEnumAccessorBody ( & $ script , Column $ column ) { $ clo = $ column -> getLowercasedName ( ) ; if ( $ column -> isLazyLoad ( ) ) { $ script .= $ this -> getAccessorLazyLoadSnippet ( $ column ) ; } $ script .= " if (null === \$this->$clo) { return null; } \$valueSet... | Adds the function body for an enum accessor method . |
48,245 | protected function addSetAccessor ( & $ script , Column $ column ) { $ this -> addSetAccessorComment ( $ script , $ column ) ; $ this -> addDefaultAccessorOpen ( $ script , $ column ) ; $ this -> addSetAccessorBody ( $ script , $ column ) ; $ this -> addDefaultAccessorClose ( $ script ) ; } | Adds a SET column getter method . |
48,246 | public function addSetAccessorComment ( & $ script , Column $ column ) { $ clo = $ column -> getLowercasedName ( ) ; $ script .= " /** * Get the [$clo] column value. * " . $ column -> getDescription ( ) ; if ( $ column -> isLazyLoad ( ) ) { $ script .= " * @param ConnectionInterface An optional Conn... | Add the comment for a SET column accessor method . |
48,247 | protected function addSetAccessorBody ( & $ script , Column $ column ) { $ clo = $ column -> getLowercasedName ( ) ; $ cloConverted = $ clo . '_converted' ; if ( $ column -> isLazyLoad ( ) ) { $ script .= $ this -> getAccessorLazyLoadSnippet ( $ column ) ; } $ this -> declareClasses ( 'Propel\Common\Util\SetColumnConve... | Adds the function body for a SET column accessor method . |
48,248 | protected function addDefaultAccessorBody ( & $ script , Column $ column ) { $ clo = $ column -> getLowercasedName ( ) ; if ( $ column -> isLazyLoad ( ) ) { $ script .= $ this -> getAccessorLazyLoadSnippet ( $ column ) ; } $ script .= " return \$this->$clo;" ; } | Adds the function body for a default accessor method . |
48,249 | protected function addLazyLoaderBody ( & $ script , Column $ column ) { $ platform = $ this -> getPlatform ( ) ; $ clo = $ column -> getLowercasedName ( ) ; if ( $ column -> getType ( ) === PropelTypes :: BLOB && $ platform instanceof SqlsrvPlatform ) { $ script .= " \$c = \$this->buildPkeyCriteria(); \$c... | Adds the function body for the lazy loader method . |
48,250 | public function addMutatorOpenOpen ( & $ script , Column $ column ) { $ cfc = $ column -> getPhpName ( ) ; $ visibility = $ this -> getTable ( ) -> isReadOnly ( ) ? 'protected' : $ column -> getMutatorVisibility ( ) ; $ typeHint = '' ; $ null = '' ; if ( $ column -> getTypeHint ( ) ) { $ typeHint = $ column -> getTypeH... | Adds the mutator function declaration . |
48,251 | protected function addMutatorOpenBody ( & $ script , Column $ column ) { $ clo = $ column -> getLowercasedName ( ) ; $ cfc = $ column -> getPhpName ( ) ; if ( $ column -> isLazyLoad ( ) ) { $ script .= " // explicitly set the is-loaded flag to true for this lazy load col; // it doesn't matter if the value... | Adds the mutator open body part . |
48,252 | protected function addMutatorCloseBody ( & $ script , Column $ column ) { $ table = $ this -> getTable ( ) ; if ( $ column -> isForeignKey ( ) ) { foreach ( $ column -> getForeignKeys ( ) as $ fk ) { $ tblFK = $ table -> getDatabase ( ) -> getTable ( $ fk -> getForeignTableName ( ) ) ; $ colFK = $ tblFK -> getColumn ( ... | Adds the body of the close part of a mutator . |
48,253 | protected function addJsonMutator ( & $ script , Column $ col ) { $ clo = $ col -> getLowercasedName ( ) ; $ this -> addJsonMutatorOpen ( $ script , $ col ) ; $ script .= " if (is_string(\$v)) { // JSON as string needs to be decoded/encoded to get a reliable comparison (spaces, ...) \$v = j... | Adds a setter for Json columns . |
48,254 | protected function addArrayMutator ( & $ script , Column $ col ) { $ clo = $ col -> getLowercasedName ( ) ; $ cloUnserialized = $ clo . '_unserialized' ; $ this -> addMutatorOpen ( $ script , $ col ) ; $ script .= " if (\$this->$cloUnserialized !== \$v) { \$this->$cloUnserialized = \$v; \$t... | Adds a setter for Array columns . |
48,255 | protected function addSetMutator ( & $ script , Column $ col ) { $ clo = $ col -> getLowercasedName ( ) ; $ this -> addSetMutatorComment ( $ script , $ col ) ; $ this -> addMutatorOpenOpen ( $ script , $ col ) ; $ this -> addMutatorOpenBody ( $ script , $ col ) ; $ cloConverted = $ clo . '_converted' ; $ this -> declar... | Adds a setter for SET column mutator . |
48,256 | protected function addHasOnlyDefaultValuesBody ( & $ script ) { $ table = $ this -> getTable ( ) ; $ colsWithDefaults = [ ] ; foreach ( $ table -> getColumns ( ) as $ col ) { $ def = $ col -> getDefaultValue ( ) ; if ( $ def !== null && ! $ def -> isExpression ( ) ) { $ colsWithDefaults [ ] = $ col ; } } foreach ( $ co... | Adds the function body for the hasOnlyDefaultValues method |
48,257 | protected function addBuildCriteria ( & $ script ) { $ this -> addBuildCriteriaComment ( $ script ) ; $ this -> addBuildCriteriaOpen ( $ script ) ; $ this -> addBuildCriteriaBody ( $ script ) ; $ this -> addBuildCriteriaClose ( $ script ) ; } | Adds the buildCriteria method |
48,258 | protected function addToArrayKeyLookUp ( $ phpName , Table $ table , $ plural ) { if ( $ phpName == "" ) { $ phpName = $ table -> getPhpName ( ) ; } $ camelCaseName = $ table -> getCamelCaseName ( ) ; $ fieldName = $ table -> getName ( ) ; if ( $ plural ) { $ phpName = $ this -> getPluralizer ( ) -> getPluralForm ( $ p... | Adds the switch - statement for looking up the array - key name for toArray |
48,259 | protected function addGetByName ( & $ script ) { $ this -> addGetByNameComment ( $ script ) ; $ this -> addGetByNameOpen ( $ script ) ; $ this -> addGetByNameBody ( $ script ) ; $ this -> addGetByNameClose ( $ script ) ; } | Adds the getByName method |
48,260 | protected function addGetByPosition ( & $ script ) { $ this -> addGetByPositionComment ( $ script ) ; $ this -> addGetByPositionOpen ( $ script ) ; $ this -> addGetByPositionBody ( $ script ) ; $ this -> addGetByPositionClose ( $ script ) ; } | Adds the getByPosition method |
48,261 | protected function addGetByPositionBody ( & $ script ) { $ table = $ this -> getTable ( ) ; $ script .= " switch (\$pos) {" ; $ i = 0 ; foreach ( $ table -> getColumns ( ) as $ col ) { $ cfc = $ col -> getPhpName ( ) ; $ script .= " case $i: return \$this->get$cfc(); brea... | Adds the function body for the getByPosition method |
48,262 | protected function addManipulationMethods ( & $ script ) { $ this -> addReload ( $ script ) ; $ this -> addDelete ( $ script ) ; $ this -> addSave ( $ script ) ; $ this -> addDoSave ( $ script ) ; $ script .= $ this -> addDoInsert ( ) ; $ script .= $ this -> addDoUpdate ( ) ; } | Adds the methods related to refreshing saving and deleting the object . |
48,263 | protected function addFKMethods ( & $ script ) { foreach ( $ this -> getTable ( ) -> getForeignKeys ( ) as $ fk ) { $ this -> declareClassFromBuilder ( $ this -> getNewStubObjectBuilder ( $ fk -> getForeignTable ( ) ) , 'Child' ) ; $ this -> declareClassFromBuilder ( $ this -> getNewStubQueryBuilder ( $ fk -> getForeig... | Adds the methods that get & set objects related by foreign key to the current object . |
48,264 | protected function addFKAttributes ( & $ script , ForeignKey $ fk ) { $ className = $ this -> getClassNameFromTable ( $ fk -> getForeignTable ( ) ) ; $ varName = $ this -> getFKVarName ( $ fk ) ; $ script .= " /** * @var $className */ protected $" . $ varName . ";" ; } | Adds the class attributes that are needed to store fkey related objects . |
48,265 | protected function addRefFKMethods ( & $ script ) { if ( ! $ referrers = $ this -> getTable ( ) -> getReferrers ( ) ) { return ; } $ this -> addInitRelations ( $ script , $ referrers ) ; foreach ( $ referrers as $ refFK ) { $ this -> declareClassFromBuilder ( $ this -> getNewStubObjectBuilder ( $ refFK -> getTable ( ) ... | Adds the methods for retrieving initializing adding objects that are related to this one by foreign keys . |
48,266 | protected function addRefFKGet ( & $ script , ForeignKey $ refFK ) { $ fkQueryClassName = $ this -> getClassNameFromBuilder ( $ this -> getNewStubQueryBuilder ( $ refFK -> getTable ( ) ) ) ; $ relCol = $ this -> getRefFKPhpNameAffix ( $ refFK , $ plural = true ) ; $ collName = $ this -> getRefFKCollVarName ( $ refFK ) ... | Adds the method that returns the referrer fkey collection . |
48,267 | protected function addCrossFKIsLoaded ( & $ script , CrossForeignKeys $ crossFKs ) { $ inits = [ ] ; if ( 1 < count ( $ crossFKs -> getCrossForeignKeys ( ) ) || $ crossFKs -> getUnclassifiedPrimaryKeys ( ) ) { $ inits [ ] = [ 'relCol' => $ this -> getCrossFKsPhpNameAffix ( $ crossFKs , true ) , 'collName' => 'combinati... | Adds the method that check if the referrer fkey collection is initialized . |
48,268 | protected function getCrossFKGetterSignature ( CrossForeignKeys $ crossFKs , $ excludeSignatureItem ) { list ( , $ getSignature ) = $ this -> getCrossFKAddMethodInformation ( $ crossFKs ) ; $ getSignature = explode ( ', ' , $ getSignature ) ; if ( false !== ( $ pos = array_search ( $ excludeSignatureItem , $ getSignatu... | Returns a function signature comma separated . |
48,269 | protected function addSaveComment ( & $ script ) { $ table = $ this -> getTable ( ) ; $ reloadOnUpdate = $ table -> isReloadOnUpdate ( ) ; $ reloadOnInsert = $ table -> isReloadOnInsert ( ) ; $ script .= " /** * Persists this object to the database. * * If the object is new, it inserts it; otherwise an u... | Adds the comment for the save method |
48,270 | protected function addSaveOpen ( & $ script ) { $ table = $ this -> getTable ( ) ; $ reloadOnUpdate = $ table -> isReloadOnUpdate ( ) ; $ reloadOnInsert = $ table -> isReloadOnInsert ( ) ; $ script .= " public function save(ConnectionInterface \$con = null" . ( $ reloadOnUpdate || $ reloadOnInsert ? ", \$skipReload ... | Adds the function declaration for the save method |
48,271 | protected function addConstants ( ) { return $ this -> renderTemplate ( 'tableMapConstants' , [ 'className' => $ this -> getClasspath ( ) , 'dbName' => $ this -> getDatabase ( ) -> getName ( ) , 'tableName' => $ this -> getTable ( ) -> getName ( ) , 'tablePhpName' => $ this -> getTable ( ) -> isAbstract ( ) ? '' : adds... | Adds any constants needed for this TableMap class . |
48,272 | protected function addColumnNameConstants ( & $ script ) { foreach ( $ this -> getTable ( ) -> getColumns ( ) as $ col ) { $ script .= " /** * the column name for the " . $ col -> getName ( ) . " field */ const " . $ col -> getConstantName ( ) . " = '" . $ this -> getTable ( ) -> getName ( ) . "." . $ col... | Adds the COLUMN_NAME constant to the class definition . |
48,273 | protected function addValueSetColumnConstants ( & $ script ) { foreach ( $ this -> getTable ( ) -> getColumns ( ) as $ col ) { if ( $ col -> isValueSetType ( ) ) { $ script .= " /** The enumerated values for the " . $ col -> getName ( ) . " field */" ; foreach ( $ col -> getValueSet ( ) as $ value ) { $ script .= " ... | Adds the valueSet constants for ENUM and SET columns . |
48,274 | protected function addClassClose ( & $ script ) { $ script .= "} // " . $ this -> getUnqualifiedClassName ( ) . "// This is the static code needed to register the TableMap for this table with the main Propel class.//" . $ this -> getUnqualifiedClassName ( ) . "::buildTableMap();" ; $ this -> applyBehaviorModifier ( 'ta... | Closes class . |
48,275 | protected function addGetPrimaryKeyHash ( & $ script ) { $ n = 0 ; $ pk = [ ] ; $ cond = [ ] ; foreach ( $ this -> getTable ( ) -> getColumns ( ) as $ col ) { if ( ! $ col -> isLazyLoad ( ) ) { if ( $ col -> isPrimaryKey ( ) ) { $ part = "\$row[TableMap::TYPE_NUM == \$indexType ? $n + \$offset : static::translateFieldN... | Adds method to get a version of the primary key that can be used as a unique key for identifier map . |
48,276 | public function modifyDatabase ( ) { foreach ( $ this -> getDatabase ( ) -> getTables ( ) as $ table ) { if ( ! $ table -> hasPrimaryKey ( ) ) { $ b = clone $ this ; $ table -> addBehavior ( $ b ) ; } } } | Copy the behavior to the database tables Only for tables that have no Pk |
48,277 | public function modifyTable ( ) { $ table = $ this -> getTable ( ) ; if ( ! $ table -> hasPrimaryKey ( ) && ! $ table -> hasBehavior ( 'concrete_inheritance' ) ) { $ columnAttributes = array_merge ( [ 'primaryKey' => 'true' ] , $ this -> getParameters ( ) ) ; $ this -> getTable ( ) -> addColumn ( $ columnAttributes ) ;... | Add the primary key to the current table |
48,278 | protected function getSchemas ( $ directory , $ recursive = false ) { $ finder = new Finder ( ) ; $ finder -> name ( '*schema.xml' ) -> sortByName ( ) -> in ( $ directory ) ; if ( ! $ recursive ) { $ finder -> depth ( 0 ) ; } return iterator_to_array ( $ finder -> files ( ) ) ; } | Find every schema files . |
48,279 | protected function parseConnection ( $ connection ) { $ pos = strpos ( $ connection , '=' ) ; $ name = substr ( $ connection , 0 , $ pos ) ; $ dsn = substr ( $ connection , $ pos + 1 , strlen ( $ connection ) ) ; $ pos = strpos ( $ dsn , ':' ) ; $ adapter = substr ( $ dsn , 0 , $ pos ) ; $ extras = [ ] ; foreach ( expl... | Parse a connection string and return an array with name dsn and extra informations |
48,280 | protected function hasInputOption ( $ option , $ input ) { return $ input -> hasOption ( $ option ) && null !== $ input -> getOption ( $ option ) ; } | Check if a given input option exists and it isn t null . |
48,281 | protected function hasInputArgument ( $ argument , $ input ) { return $ input -> hasArgument ( $ argument ) && null !== $ input -> getArgument ( $ argument ) ; } | Check if a given input argument exists and it isn t null . |
48,282 | public static function create ( array $ configuration = [ ] , AdapterInterface $ adapter , $ defaultConnectionClass = self :: DEFAULT_CONNECTION_CLASS ) { if ( isset ( $ configuration [ 'classname' ] ) ) { $ connectionClass = $ configuration [ 'classname' ] ; } else { $ connectionClass = $ defaultConnectionClass ; } tr... | Open a database connection based on a configuration . |
48,283 | public function fromArray ( $ arr ) { $ obj = $ this -> getWorkerObject ( ) ; foreach ( $ arr as $ element ) { $ obj -> clear ( ) ; $ obj -> fromArray ( $ element ) ; $ this -> append ( $ obj -> toArray ( ) ) ; } } | Populates the collection from an array Uses the object model to force the column types Does not empty the collection before adding the data from the array |
48,284 | public static function log ( $ message , $ level = self :: LOG_DEBUG ) { $ logger = self :: $ serviceContainer -> getLogger ( ) ; switch ( $ level ) { case self :: LOG_EMERG : return $ logger -> emergency ( $ message ) ; case self :: LOG_ALERT : return $ logger -> alert ( $ message ) ; case self :: LOG_CRIT : return $ ... | Logs a message If a logger has been configured the logger will be used otherwise the logging message will be discarded without any further action |
48,285 | public function getTableMap ( ) { if ( null === $ this -> tableMap && null !== $ this -> relationMap ) { $ this -> tableMap = $ this -> relationMap -> getRightTable ( ) ; } return $ this -> tableMap ; } | Gets the right tableMap for this join |
48,286 | public static function classname ( $ qualifiedName ) { if ( false !== $ pos = strrpos ( $ qualifiedName , '.' ) ) { return substr ( $ qualifiedName , $ pos + 1 ) ; } elseif ( false !== $ pos = strrpos ( $ qualifiedName , '\\' ) ) { return substr ( $ qualifiedName , $ pos + 1 ) ; } else { return $ qualifiedName ; } } | Gets just classname given a dot - path to class . |
48,287 | protected function forceNamespace ( $ code ) { if ( 0 === preg_match ( '/\nnamespace/' , $ code ) ) { $ use = array_filter ( explode ( PHP_EOL , $ code ) , function ( $ string ) { return substr ( $ string , 0 , 5 ) === 'use \\' ; } ) ; $ code = str_replace ( $ use , '' , $ code ) ; return "\nnamespace\n{\n" . $ code . ... | Prevent generated class without namespace to fail . |
48,288 | protected function addTableVendorInfo ( Table $ table ) { $ stmt = $ this -> dbh -> query ( "SHOW TABLE STATUS LIKE '" . $ table -> getName ( ) . "'" ) ; $ row = $ stmt -> fetch ( \ PDO :: FETCH_ASSOC ) ; if ( ! $ this -> addVendorInfo ) { $ row = [ 'Engine' => $ row [ 'Engine' ] ] ; } $ vi = $ this -> getNewVendorInfo... | Adds vendor - specific info for table . |
48,289 | public function objectAttributes ( $ builder ) { $ relationName = $ this -> getRelationName ( $ builder ) ; $ relatedClass = $ builder -> getClassNameFromBuilder ( $ builder -> getNewStubObjectBuilder ( $ this -> getForeignTable ( ) ) ) ; $ aggregateName = $ this -> getParameter ( 'aggregate_name' ) ; return "/** * @va... | which already has a hook |
48,290 | protected function getPath ( $ file ) { $ path = $ this -> locator -> locate ( $ file ) ; if ( ! is_readable ( $ path ) ) { throw new InputOutputException ( "You don't have permissions to access configuration file $file." ) ; } return $ path ; } | Get the pathof a given resource |
48,291 | protected function checkSupports ( $ ext , $ resource ) { if ( ! is_string ( $ resource ) ) { return false ; } $ info = pathinfo ( $ resource ) ; $ extension = $ info [ 'extension' ] ; if ( 'dist' === $ extension ) { $ extension = pathinfo ( $ info [ 'filename' ] , PATHINFO_EXTENSION ) ; } if ( is_string ( $ ext ) ) { ... | Check if a resource has a given extension |
48,292 | private function resolveString ( $ value , array $ resolving = [ ] ) { if ( preg_match ( '/^%([^%\s]+)%$/' , $ value , $ match ) ) { if ( null !== $ ret = $ this -> parseEnvironmentParams ( $ match [ 1 ] ) ) { return $ ret ; } $ key = $ match [ 1 ] ; if ( isset ( $ resolving [ $ key ] ) ) { throw new RuntimeException (... | Resolves parameters inside a string |
48,293 | private function get ( $ property_key ) { $ found = false ; $ ret = $ this -> getValue ( $ property_key , null , $ found ) ; if ( false === $ found ) { throw new InvalidArgumentException ( "Parameter '$property_key' not found in configuration file." ) ; } return $ ret ; } | Return the value correspondent to a given key . |
48,294 | private function getValue ( $ property_key , $ config = null , & $ found ) { if ( null === $ config ) { $ config = $ this -> config ; } foreach ( $ config as $ key => $ value ) { if ( $ key === $ property_key ) { $ found = true ; return $ value ; } if ( is_array ( $ value ) ) { $ ret = $ this -> getValue ( $ property_k... | Scan recursively an array to find a value of a given key . |
48,295 | private function parseEnvironmentParams ( $ value ) { $ env = explode ( '.' , $ value ) ; if ( 'env' === $ env [ 0 ] ) { $ envParam = getenv ( $ env [ 1 ] ) ; if ( false === $ envParam ) { throw new InvalidArgumentException ( "Environment variable '$env[1]' is not defined." ) ; } return $ envParam ; } return null ; } | Check if the parameter contains an environment variable and parse it |
48,296 | public function setMaxPerPage ( $ max ) { if ( $ max > 0 ) { $ this -> maxPerPage = $ max ; if ( 0 === $ this -> page ) { $ this -> page = 1 ; } } elseif ( 0 === $ max ) { $ this -> maxPerPage = 0 ; $ this -> page = 0 ; } else { $ this -> maxPerPage = 1 ; if ( 0 === $ this -> page ) { $ this -> page = 1 ; } } } | Set the maximum number results per page |
48,297 | public function getMigrationTableDDL ( TableDiff $ tableDiff ) { $ pattern = "CREATE TEMPORARY TABLE %s AS SELECT %s FROM %s;DROP TABLE %s;%sINSERT INTO %s (%s) SELECT %s FROM %s;DROP TABLE %s;" ; $ originTable = clone $ tableDiff -> getFromTable ( ) ; $ newTable = clone $ tableDiff -> getToTable ( ) ; $ originTableNam... | Creates a temporarily created table with the new schema moves all items into it and drops the origin as well as renames the temp table to the origin then . |
48,298 | public function normalizeTable ( Table $ table ) { if ( $ table -> getPrimaryKey ( ) ) { $ pkUniqueExist = false ; foreach ( $ table -> getUnices ( ) as $ unique ) { $ coversAllPrimaryKeys = true ; foreach ( $ unique -> getColumns ( ) as $ columnName ) { if ( ! $ table -> getColumn ( $ columnName ) -> isPrimaryKey ( ) ... | Unfortunately SQLite does not support composite pks where one is AUTOINCREMENT so we have to flag both as NOT NULL and create in either way a UNIQUE constraint over pks since those UNIQUE is otherwise automatically created by the sqlite engine . |
48,299 | protected function cleanMethod ( $ schemaName ) { $ name = '' ; $ regexp = '/([a-z0-9]+)/i' ; $ matches = [ ] ; if ( ! preg_match_all ( $ regexp , $ schemaName , $ matches ) ) { return $ schemaName ; } foreach ( $ matches [ 1 ] as $ tok ) { $ name .= ucfirst ( strtolower ( $ tok ) ) ; } return $ name ; } | Converts a database schema name to php object name . Removes any character that is not a letter or a number and capitalizes first letter of the name the first letter of each alphanumeric block and converts the rest of the letters to lowercase . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.