idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
42,600
private function renderCollection ( EnvironmentInterface $ environment , CollectionInterface $ collection , $ grouping ) { $ listing = $ this -> getViewSection ( $ environment -> getDataDefinition ( ) ) -> getListingConfig ( ) ; $ remoteCur = null ; $ groupClass = 'tl_folder_tlist' ; $ eoCount = - 1 ; if ( 'select' !==...
Render the collection .
42,601
private function addGroupHeader ( EnvironmentInterface $ environment , array $ grouping , ModelInterface $ model , & $ groupClass , & $ eoCount , & $ remoteCur = null ) { if ( $ grouping && GroupAndSortingInformationInterface :: GROUP_NONE !== $ grouping [ 'mode' ] ) { $ remoteNew = $ this -> renderGroupHeader ( $ grou...
Add the group header information to the model .
42,602
private function getTableHead ( EnvironmentInterface $ environment ) { $ tableHead = [ ] ; $ definition = $ environment -> getDataDefinition ( ) ; $ properties = $ definition -> getPropertiesDefinition ( ) ; $ formatter = $ this -> getViewSection ( $ definition ) -> getListingConfig ( ) -> getLabelFormatter ( $ definit...
Get the table headings .
42,603
private function isSortable ( EnvironmentInterface $ environment ) { return ( ( true === ( bool ) ViewHelpers :: getManualSortingProperty ( $ environment ) ) && ( true === $ environment -> getDataDefinition ( ) -> getBasicDefinition ( ) -> isEditable ( ) ) ) ; }
Check if the models are sortable .
42,604
protected function renderPasteTopButton ( EnvironmentInterface $ environment , $ sorting ) { $ definition = $ environment -> getDataDefinition ( ) ; $ dispatcher = $ environment -> getEventDispatcher ( ) ; $ languageDomain = 'contao_' . $ definition -> getName ( ) ; $ filter = new Filter ( ) ; $ filter -> andModelIsFro...
Render paste top button . Returns null if no button should be rendered .
42,605
private function getSortingColumns ( $ sortingDefinition ) { if ( null === $ sortingDefinition ) { return [ ] ; } $ sortingColumns = [ ] ; foreach ( $ sortingDefinition as $ information ) { if ( $ information -> getProperty ( ) ) { $ sortingColumns [ ] = $ information -> getProperty ( ) ; } } return $ sortingColumns ; ...
Determine the current sorting columns .
42,606
public function getPanelElementTemplate ( GetPanelElementTemplateEvent $ event ) { if ( ! $ this -> scopeDeterminator -> currentScopeIsBackend ( ) ) { return ; } if ( $ event -> getTemplate ( ) ) { return ; } $ element = $ event -> getElement ( ) ; if ( $ element instanceof FilterElementInterface ) { $ event -> setTemp...
Create a template instance for the default panel elements if none has been created yet .
42,607
public function resolveWidgetErrorMessage ( ResolveWidgetErrorMessageEvent $ event ) { if ( ! $ this -> scopeDeterminator -> currentScopeIsBackend ( ) ) { return ; } $ error = $ event -> getError ( ) ; if ( $ error instanceof \ Exception ) { $ event -> setError ( $ error -> getMessage ( ) ) ; } elseif ( \ is_object ( $...
Resolve a widget error message .
42,608
protected static function getOptions ( $ environment , $ model , $ property ) { $ event = new GetPropertyOptionsEvent ( $ environment , $ model ) ; $ event -> setPropertyName ( $ property -> getName ( ) ) ; $ event -> setOptions ( $ property -> getOptions ( ) ) ; $ environment -> getEventDispatcher ( ) -> dispatch ( $ ...
Fetch the options for a certain property .
42,609
private static function decodeValue ( $ environment , $ model , $ property , $ value ) { $ event = new DecodePropertyValueForWidgetEvent ( $ environment , $ model ) ; $ event -> setProperty ( $ property ) -> setValue ( $ value ) ; $ environment -> getEventDispatcher ( ) -> dispatch ( \ sprintf ( '%s' , $ event :: NAME ...
Decode a value from native data of the data provider to the widget via event .
42,610
private static function parseDateTime ( EventDispatcherInterface $ dispatcher , $ dateFormat , $ timeStamp ) { $ dateEvent = new ParseDateEvent ( $ timeStamp , $ dateFormat ) ; $ dispatcher -> dispatch ( ContaoEvents :: DATE_PARSE , $ dateEvent ) ; return $ dateEvent -> getResult ( ) ; }
Render a timestamp using the given format .
42,611
public function renderReadablePropertyValue ( RenderReadablePropertyValueEvent $ event ) { if ( ! $ this -> scopeDeterminator -> currentScopeIsBackend ( ) ) { return ; } if ( null !== $ event -> getRendered ( ) ) { return ; } $ property = $ event -> getProperty ( ) ; $ value = self :: decodeValue ( $ event -> getEnviro...
Render a property value to readable text .
42,612
public function initTwig ( \ ContaoTwigInitializeEvent $ event ) { if ( ! $ this -> scopeDeterminator -> currentScopeIsBackend ( ) ) { return ; } $ contaoTwig = $ event -> getContaoTwig ( ) ; $ environment = $ contaoTwig -> getEnvironment ( ) ; $ environment -> addExtension ( new DcGeneralExtension ( ) ) ; }
Add custom twig extension .
42,613
public function initializePanels ( ActionEvent $ event ) { if ( ! $ this -> scopeDeterminator -> currentScopeIsBackend ( ) ) { return ; } if ( ! \ in_array ( $ event -> getAction ( ) -> getName ( ) , [ 'copy' , 'create' , 'paste' , 'delete' , 'move' , 'undo' , 'edit' , 'toggle' , 'showAll' , 'show' ] ) ) { return ; } $...
Initialize the panels for known actions so that they always know their state .
42,614
private static function renderForeignKeyReadable ( RenderReadablePropertyValueEvent $ event , $ extra , $ value ) { if ( ! isset ( $ extra [ 'foreignKey' ] ) || ( null !== $ event -> getRendered ( ) ) ) { return ; } }
Render a foreign key reference .
42,615
private static function renderArrayReadable ( RenderReadablePropertyValueEvent $ event , $ value ) { if ( ! \ is_array ( $ value ) || ( null !== $ event -> getRendered ( ) ) ) { return ; } foreach ( $ value as $ kk => $ vv ) { if ( \ is_array ( $ vv ) ) { $ vals = \ array_values ( $ vv ) ; $ value [ $ kk ] = $ vals [ 0...
Render an array as readable property value .
42,616
private static function renderTimestampReadable ( RenderReadablePropertyValueEvent $ event , $ extra , $ value ) { if ( ! isset ( $ extra [ 'rgxp' ] ) || ! ( ( 'date' === $ extra [ 'rgxp' ] ) || ( 'time' === $ extra [ 'rgxp' ] ) || ( 'datim' === $ extra [ 'rgxp' ] ) ) || ( null !== $ event -> getRendered ( ) ) ) { retu...
Render a timestamp .
42,617
private static function renderDateTimePropertyIsTstamp ( RenderReadablePropertyValueEvent $ event , $ property , $ value ) { if ( ( null !== $ event -> getRendered ( ) ) || ( 'tstamp' !== $ property -> getName ( ) ) ) { return ; } $ dispatcher = $ event -> getEnvironment ( ) -> getEventDispatcher ( ) ; $ event -> setRe...
Render date time when property is tstamp .
42,618
private static function renderSimpleCheckbox ( RenderReadablePropertyValueEvent $ event , $ property , $ extra , $ value ) { if ( ( null !== $ event -> getRendered ( ) ) || ! ( ! $ extra [ 'multiple' ] && ( 'checkbox' === $ property -> getWidgetType ( ) ) ) ) { return ; } $ map = [ false => 'no' , true => 'yes' ] ; $ e...
Render for simple checkobx
42,619
private static function renderDateTimeValueInstance ( $ event , $ value ) { if ( ! ( $ value instanceof \ DateTime ) ) { return ; } $ dispatcher = $ event -> getEnvironment ( ) -> getEventDispatcher ( ) ; $ event -> setRendered ( self :: parseDateTime ( $ dispatcher , self :: getConfig ( ) -> get ( 'datimFormat' ) , $ ...
Render datetime if the value is instance of datetime .
42,620
private static function renderTextAreaReadable ( RenderReadablePropertyValueEvent $ event , $ property , $ extra , $ value ) { if ( ( empty ( $ extra [ 'allowHtml' ] ) && empty ( $ extra [ 'preserveTags' ] ) ) || ( null !== $ event -> getRendered ( ) ) || ( 'textarea' !== $ property -> getWidgetType ( ) ) ) { return ; ...
Render a string if not allow html or preserve tags is given .
42,621
private static function renderOptionValueReadable ( RenderReadablePropertyValueEvent $ event , $ property , $ value ) { if ( ! ( $ options = $ property -> getOptions ( ) ) ) { $ options = self :: getOptions ( $ event -> getEnvironment ( ) , $ event -> getModel ( ) , $ event -> getProperty ( ) ) ; if ( $ options ) { $ p...
Render a property option .
42,622
public function setResponse ( $ response ) { $ this -> response = ( null !== $ response ) ? ( string ) $ response : null ; return $ this ; }
Set the action response .
42,623
public function setCachePath ( string $ cachePath ) { $ this -> cachePath = $ cachePath ; if ( ! is_dir ( $ this -> cachePath ) ) { FileHelper :: createDirectory ( $ this -> cachePath , $ this -> dirMode , true ) ; } }
Sets cache path and ensures it exists .
42,624
public function getProperty ( $ propertyName ) { if ( 'id' === $ propertyName ) { return $ this -> getID ( ) ; } if ( \ array_key_exists ( $ propertyName , $ this -> arrProperties ) ) { return $ this -> arrProperties [ $ propertyName ] ; } return null ; }
Fetch the property with the given name from the model .
42,625
public function setID ( $ mixID ) { if ( null === $ this -> mixID ) { $ this -> setIdRaw ( $ mixID ) ; $ this -> setMeta ( static :: IS_CHANGED , true ) ; } }
Set the id for this object .
42,626
public function setProperty ( $ propertyName , $ value ) { if ( $ value !== $ this -> getProperty ( $ propertyName ) ) { $ this -> setMeta ( static :: IS_CHANGED , true ) ; $ this -> setPropertyRaw ( $ propertyName , $ value ) ; } }
Update the property value in the model .
42,627
public function setPropertiesAsArray ( $ properties ) { if ( \ is_array ( $ properties ) ) { if ( \ array_key_exists ( 'id' , $ properties ) ) { unset ( $ properties [ 'id' ] ) ; } foreach ( $ properties as $ propertyName => $ value ) { $ this -> setProperty ( $ propertyName , $ value ) ; } } }
Update all properties in the model .
42,628
private function renderHeaderFields ( $ parentModel , EnvironmentInterface $ environment ) { $ definition = $ environment -> getDataDefinition ( ) ; $ parentName = $ definition -> getBasicDefinition ( ) -> getParentDataProvider ( ) ; $ add = [ ] ; $ properties = $ environment -> getParentDataDefinition ( ) -> getProper...
Render the header of the parent view with information from the parent table .
42,629
private function translateHeaderColumnName ( $ field , $ parentName ) { return ( 'tstamp' === $ field ) ? $ this -> translate ( 'MSC.tstamp' , 'contao_default' ) : $ this -> translate ( \ sprintf ( '%s.0' , $ field ) , $ parentName ) ; }
Translate a column name for use in parent model display section .
42,630
private function renderParentProperty ( EnvironmentInterface $ environment , $ property , $ value ) { $ evaluation = $ property -> getExtra ( ) ; if ( \ is_array ( $ value ) ) { return \ implode ( ', ' , $ value ) ; } $ isRendered = false ; $ value = $ this -> renderForCheckbox ( $ property , $ value , $ isRendered ) ;...
Render a property of the parent model .
42,631
private function renderForCheckbox ( PropertyInterface $ property , $ value , & $ isRendered ) { $ evaluation = $ property -> getExtra ( ) ; if ( ( true === $ isRendered ) || $ evaluation [ 'multiple' ] || ! ( 'checkbox' === $ property -> getWidgetType ( ) ) ) { return $ value ; } $ isRendered = true ; return ! empty (...
Render for checkbox .
42,632
private function renderForDateTime ( EnvironmentInterface $ environment , PropertyInterface $ property , $ value , & $ isRendered ) { $ evaluation = $ property -> getExtra ( ) ; if ( ( true === $ isRendered ) || ! $ value || ! \ in_array ( $ evaluation [ 'rgxp' ] , [ 'date' , 'time' , 'datim' ] ) ) { return $ value ; }...
Render for date time .
42,633
protected function handleSubmit ( Action $ action , EnvironmentInterface $ environment ) { $ inputProvider = $ environment -> getInputProvider ( ) ; $ sessionStorage = $ environment -> getSessionStorage ( ) ; $ eventDispatcher = $ environment -> getEventDispatcher ( ) ; if ( ( 'auto' === $ inputProvider -> getValue ( '...
Handle submit triggered button .
42,634
protected function editCollection ( Action $ action , CollectionInterface $ collection , PropertyValueBagInterface $ propertyValueBag , \ ArrayObject $ renderInformation , EnvironmentInterface $ environment ) { while ( $ collection -> count ( ) > 0 ) { $ model = $ collection -> shift ( ) ; $ persistPropertyValueBag = $...
Edit collection of models .
42,635
protected function updateErrorInformation ( \ ArrayObject $ renderInformation ) { $ modelError = $ renderInformation -> offsetGet ( 'modelError' ) ; if ( null === $ modelError ) { return ; } $ error = [ ] ; foreach ( \ array_keys ( $ modelError ) as $ modelId ) { $ error [ ] = \ sprintf ( '<strong><a href="%s#pal_%s">%...
Update the error information .
42,636
private function cloneCleanPropertyValueBag ( Action $ action , PropertyValueBagInterface $ propertyValueBag , ModelInterface $ model , EnvironmentInterface $ environment ) { $ sessionProperties = $ this -> getPropertiesFromSession ( $ action , $ environment ) ; $ clonePropertyValueBag = clone $ propertyValueBag ; fore...
Clone and clean property value bag .
42,637
private function resetPropertyValueErrors ( PropertyValueBagInterface $ propertyValueBag ) { foreach ( \ array_keys ( $ propertyValueBag -> getInvalidPropertyErrors ( ) ) as $ errorProperty ) { $ propertyValueBag -> resetPropertyValueErrors ( $ errorProperty ) ; } }
Reset property value errors .
42,638
private function markPropertyInvalidErrorsByModel ( PropertyValueBagInterface $ propertyValueBag , ModelInterface $ model , \ ArrayObject $ renderInformation , EnvironmentInterface $ environment ) { $ editInformation = $ GLOBALS [ 'container' ] [ 'dc-general.edit-information' ] ; $ errorInformation = $ editInformation ...
Mark property in invalid errors by model .
42,639
private function updatePropertyValueBag ( Action $ action , ModelInterface $ model , PropertyValueBagInterface $ sourcePropertyValueBag , PropertyValueBagInterface $ updatePropertyValueBag , EnvironmentInterface $ environment ) { $ dataProvider = $ environment -> getDataProvider ( ) ; $ sessionProperties = $ this -> ge...
Update property value bag .
42,640
private function handleEditHandler ( Action $ action , ModelInterface $ model , PropertyValueBagInterface $ propertyValueBag , EnvironmentInterface $ environment ) { $ inputProvider = $ environment -> getInputProvider ( ) ; $ editInformation = $ GLOBALS [ 'container' ] [ 'dc-general.edit-information' ] ; $ inputValues ...
Handle the edit handler .
42,641
private function handleInputValues ( Action $ action , ModelInterface $ model , EnvironmentInterface $ environment ) { $ editProperties = $ this -> getEditPropertiesByModelId ( $ action , ModelId :: fromModel ( $ model ) , $ environment ) ; if ( ! $ editProperties ) { return [ ] ; } $ inputProvider = $ environment -> g...
Handle input values and return it .
42,642
protected function restoreInputValues ( Action $ action , ModelInterface $ model , PropertyValueBagInterface $ propertyValueBag , array $ inputValues , EnvironmentInterface $ environment ) { $ editProperties = $ this -> getEditPropertiesByModelId ( $ action , ModelId :: fromModel ( $ model ) , $ environment ) ; if ( ! ...
Restore input values .
42,643
protected function getEditButtons ( Action $ action , EnvironmentInterface $ environment ) { $ translator = $ environment -> getTranslator ( ) ; $ mode = $ this -> getMode ( $ action ) ; $ buttons = [ ] ; $ buttons [ 'save' ] = \ sprintf ( '<input type="submit" name="%s_save" id="%s_save" class="tl_submit" accesskey="s...
Retrieve buttons to use in the bottom panel .
42,644
protected function renderTemplate ( Action $ action , array $ config ) { $ template = new ContaoBackendViewTemplate ( 'dcbe_general_edit' ) ; $ template -> setData ( $ config ) ; $ template -> set ( 'mode' , $ this -> getMode ( $ action ) ) ; return $ template -> parse ( ) ; }
Render the template for the edit mask .
42,645
protected function getPropertyValueBagFromModel ( Action $ action , ModelInterface $ model , EnvironmentInterface $ environment ) { $ propertiesDefinition = $ environment -> getDataDefinition ( ) -> getPropertiesDefinition ( ) ; $ editInformation = $ GLOBALS [ 'container' ] [ 'dc-general.edit-information' ] ; $ propert...
Get property value bag from the model .
42,646
protected function getCollectionFromSession ( Action $ action , EnvironmentInterface $ environment ) { $ inputProvider = $ environment -> getInputProvider ( ) ; $ sessionStorage = $ environment -> getSessionStorage ( ) ; $ dataDefinition = $ environment -> getDataDefinition ( ) ; $ dataProvider = $ environment -> getDa...
Return select model collection from the session .
42,647
protected function getEditPropertiesByModelId ( Action $ action , ModelIdInterface $ modelId , EnvironmentInterface $ environment ) { $ session = $ this -> getSession ( $ action , $ environment ) ; return $ session [ 'editProperties' ] [ $ modelId -> getSerialized ( ) ] ; }
Get the edit properties by model id .
42,648
protected function revertValuesByErrors ( Action $ action , CollectionInterface $ collection , EnvironmentInterface $ environment ) { $ editInformation = $ GLOBALS [ 'container' ] [ 'dc-general.edit-information' ] ; if ( ! $ editInformation -> hasAnyModelError ( ) ) { return ; } $ dataProvider = $ environment -> getDat...
Revert model values if their have errors .
42,649
private function handlePostPersist ( ModelInterface $ model , ModelInterface $ originalModel , EnvironmentInterface $ environment ) { $ event = new PostPersistModelEvent ( $ environment , $ model , $ originalModel ) ; $ environment -> getEventDispatcher ( ) -> dispatch ( $ event :: NAME , $ event ) ; }
Trigger the post persist event if available .
42,650
public function parseFilter ( $ filter , $ model ) { $ this -> guardProviderNames ( null , $ model ) ; $ applied = [ 'operation' => $ filter [ 'operation' ] , ] ; if ( isset ( $ filter [ 'local' ] ) ) { $ applied [ 'property' ] = $ filter [ 'local' ] ; } if ( isset ( $ filter [ 'remote' ] ) ) { $ applied [ 'value' ] = ...
Apply the filter values for a given model to the given rule .
42,651
private function isValidSetter ( $ setter ) { return ( \ is_array ( $ setter ) && ( 2 === \ count ( $ setter ) ) && isset ( $ setter [ 'to_field' ] ) && ( isset ( $ setter [ 'from_field' ] ) || isset ( $ setter [ 'value' ] ) ) ) ; }
Check if the passed value is a valid setter .
42,652
private function extractNeededProperties ( $ rule ) { if ( \ in_array ( $ rule [ 'operation' ] , [ 'AND' , 'OR' ] ) ) { $ properties = [ ] ; foreach ( $ rule [ 'children' ] as $ childRule ) { $ properties [ ] = $ this -> extractNeededProperties ( $ childRule ) ; } return $ properties ; } if ( isset ( $ rule [ 'local' ]...
Return the names of the needed properties for filtering .
42,653
private function guardProviderNames ( $ child , $ parent = null ) { if ( null !== $ child && $ child -> getProviderName ( ) !== $ this -> destinationProvider ) { throw new \ InvalidArgumentException ( \ sprintf ( 'provider name %s is not equal to %s' , $ child -> getProviderName ( ) , $ this -> destinationProvider ) ) ...
Guard that the data provider names match .
42,654
public function get ( $ index ) { if ( \ array_key_exists ( $ index , $ this -> arrCollection ) ) { return $ this -> arrCollection [ $ index ] ; } return null ; }
Get the model at a specific index .
42,655
public function insert ( $ index , ModelInterface $ model ) { if ( $ model -> hasProperties ( ) ) { \ array_insert ( $ this -> arrCollection , $ index , [ $ model ] ) ; } }
Insert a record at the specific position .
42,656
public function remove ( $ indexValue ) { if ( \ is_object ( $ indexValue ) ) { foreach ( $ this -> arrCollection as $ collectionIndex => $ model ) { if ( $ indexValue === $ model ) { unset ( $ this -> arrCollection [ $ collectionIndex ] ) ; } } } else { unset ( $ this -> arrCollection [ $ indexValue ] ) ; } $ this -> ...
Remove the given index or model from the collection and renew the index .
42,657
public function removeById ( $ modelId ) { foreach ( $ this -> arrCollection as $ index => $ model ) { if ( $ modelId === $ model -> getId ( ) ) { unset ( $ this -> arrCollection [ $ index ] ) ; } } }
Remove the model with the given id from the collection .
42,658
public function containsById ( $ modelId ) { foreach ( $ this as $ localModel ) { if ( $ modelId === $ localModel -> getId ( ) ) { return true ; } } return false ; }
Check whether the given model is contained in the collection .
42,659
public function intersect ( $ collection ) { $ intersection = new DefaultCollection ( ) ; foreach ( $ this as $ localModel ) { foreach ( $ collection as $ otherModel ) { if ( ( $ localModel -> getProviderName ( ) === $ otherModel -> getProviderName ( ) ) && ( $ localModel -> getId ( ) === $ otherModel -> getId ( ) ) ) ...
Intersect the given collection with this collection and return the result .
42,660
public function union ( $ collection ) { $ union = clone $ this ; foreach ( $ collection -> diff ( $ this ) as $ otherModel ) { $ union -> push ( $ otherModel ) ; } return $ union ; }
Compute the union of this collection and the given collection .
42,661
public function diff ( $ collection ) { $ diff = new DefaultCollection ( ) ; foreach ( $ this as $ localModel ) { foreach ( $ collection as $ otherModel ) { if ( ( $ localModel -> getProviderName ( ) === $ otherModel -> getProviderName ( ) ) && ( $ localModel -> getId ( ) === $ otherModel -> getId ( ) ) ) { continue ; ...
Computes the difference of the collection .
42,662
public function isSubsetOf ( $ collection ) { foreach ( $ this as $ localModel ) { foreach ( $ collection as $ otherModel ) { if ( ( $ localModel -> getProviderName ( ) === $ otherModel -> getProviderName ( ) ) && ( $ localModel -> getId ( ) === $ otherModel -> getId ( ) ) ) { continue ; } return false ; } } return tru...
Check if the given collection is an subset of the given collection .
42,663
public function sort ( $ callback ) { $ newCollection = clone $ this ; \ uasort ( $ newCollection -> arrCollection , $ callback ) ; $ newCollection -> arrCollection = \ array_values ( $ newCollection -> arrCollection ) ; return $ newCollection ; }
Sort the records with the given callback and return the new sorted collection .
42,664
public function populateController ( EnvironmentInterface $ environment ) { $ definition = $ environment -> getDataDefinition ( ) ; if ( ! $ definition -> getBasicDefinition ( ) -> getParentDataProvider ( ) ) { return ; } $ parentDefinition = ( new DcGeneralFactory ( ) ) -> setEventDispatcher ( $ environment -> getEven...
Create a parent data definition if parent data provider defined .
42,665
public function setPropertyValueCondition ( $ condition ) { if ( ! ( $ condition instanceof PalettePropertyValueCondition ) && ( ! $ condition instanceof PropertyValueCondition ) ) { throw new DcGeneralInvalidArgumentException ( 'The condition is invalid. ' . ' Only use PalettePropertyValueCondition or PropertyValueCon...
Set the property value condition .
42,666
public static function getBuilderFromArray ( $ filter , $ builder ) { switch ( $ filter [ 'operation' ] ) { case 'AND' : return AndFilterBuilder :: fromArray ( $ filter , $ builder ) ; case 'OR' : return OrFilterBuilder :: fromArray ( $ filter , $ builder ) ; case '=' : return PropertyEqualsFilterBuilder :: fromArray (...
Instantiate the correct builder class from a given filter array .
42,667
public function encapsulateOr ( ) { $ root = $ this -> filters ; $ this -> filters = new AndFilterBuilder ( ) ; $ this -> filters -> setBuilder ( $ this ) ; $ orFilter = new OrFilterBuilder ( [ $ root ] ) ; $ this -> filters -> add ( $ orFilter ) ; return $ orFilter ; }
Encapsulate the root with an Or condition and return the OR condition .
42,668
private function guardProviderName ( $ model ) { if ( $ model -> getProviderName ( ) !== $ this -> sourceProvider ) { throw new \ InvalidArgumentException ( \ sprintf ( 'provider name %s is not equal to %s' , $ model -> getProviderName ( ) , $ this -> getSourceName ( ) ) ) ; } }
Guard that the data provider name matches .
42,669
private function getReferrerUrl ( EnvironmentInterface $ environment ) { $ parent = $ environment -> getParentDataDefinition ( ) ; $ event = new GetReferrerEvent ( true , ( null !== $ parent ) ? $ parent -> getName ( ) : $ environment -> getDataDefinition ( ) -> getName ( ) ) ; $ environment -> getEventDispatcher ( ) -...
Determine the correct referrer URL .
42,670
public function enableDefaultUuidGenerator ( ) { if ( $ this -> idGenerator ) { throw new DcGeneralRuntimeException ( 'Error: already an id generator set on database provider.' ) ; } $ this -> setIdGenerator ( new DatabaseUuidIdGenerator ( $ this -> connection ) ) ; return $ this ; }
Create an instance of the default database driven uuid generator .
42,671
protected function createModelFromDatabaseResult ( array $ result ) { $ model = $ this -> getEmptyModel ( ) ; foreach ( $ result as $ key => $ value ) { if ( $ key === $ this -> idProperty ) { $ model -> setIdRaw ( $ value ) ; } $ model -> setPropertyRaw ( $ key , StringUtil :: deserialize ( $ value ) ) ; } return $ mo...
Create a model from a database result .
42,672
private function prefixDataProviderProperties ( ConfigInterface $ config ) { $ internalConfig = clone $ config ; $ this -> sortingPrefixer ( $ internalConfig ) ; if ( null !== ( $ filter = $ internalConfig -> getFilter ( ) ) ) { $ this -> filterPrefixer ( $ filter ) ; $ internalConfig -> setFilter ( $ filter ) ; } if (...
Prefix the data provider properties .
42,673
private function sortingPrefixer ( ConfigInterface $ config ) { $ sorting = [ ] ; foreach ( $ config -> getSorting ( ) as $ property => $ value ) { if ( 0 === \ strpos ( $ property , $ this -> source . '.' ) ) { $ sorting [ $ property ] = $ value ; continue ; } if ( ! $ this -> fieldExists ( $ property ) ) { continue ;...
The config sorting prefixer .
42,674
private function filterPrefixer ( array & $ filter ) { foreach ( $ filter as & $ child ) { if ( \ array_key_exists ( 'property' , $ child ) && ( false === \ strpos ( $ child [ 'property' ] , $ this -> source . '.' ) ) && $ this -> fieldExists ( $ child [ 'property' ] ) ) { $ child [ 'property' ] = $ this -> source . '....
The filter prefixer .
42,675
private function fieldPrefixer ( array & $ fields ) { foreach ( $ fields as $ index => $ property ) { if ( 0 === \ strpos ( $ property , $ this -> source . '.' ) || ! $ this -> fieldExists ( $ property ) ) { continue ; } $ fields [ $ index ] = $ this -> source . '.' . $ property ; } }
The field prefixer .
42,676
private function convertModelToDataPropertyArray ( ModelInterface $ model , $ timestamp = 0 ) { $ data = [ ] ; foreach ( $ model as $ key => $ value ) { if ( $ key === $ this -> idProperty ) { continue ; } if ( \ is_array ( $ value ) ) { $ data [ $ this -> source . '.' . $ key ] = \ serialize ( $ value ) ; } else { $ d...
Convert a model into a property array to be used in insert and update queries .
42,677
private function insertModelIntoDatabase ( ModelInterface $ model , $ timestamp = 0 ) { $ data = $ this -> convertModelToDataPropertyArray ( $ model , $ timestamp ) ; if ( $ this -> getIdGenerator ( ) ) { $ model -> setId ( $ this -> getIdGenerator ( ) -> generate ( ) ) ; $ data [ $ this -> idProperty ] = $ model -> ge...
Insert the model into the database .
42,678
public function getVersions ( $ mixID , $ onlyActive = false ) { $ queryBuilder = $ this -> connection -> createQueryBuilder ( ) ; $ queryBuilder -> select ( [ 'tstamp' , 'version' , 'username' , 'active' ] ) ; $ queryBuilder -> from ( 'tl_version' ) ; $ queryBuilder -> andWhere ( $ queryBuilder -> expr ( ) -> eq ( 'tl...
Return a list with all versions for the row with the given Id .
42,679
public function saveVersion ( ModelInterface $ model , $ username ) { $ queryBuilder = $ this -> connection -> createQueryBuilder ( ) ; $ queryBuilder -> select ( 'COUNT(*) AS count' ) ; $ queryBuilder -> from ( 'tl_version' ) ; $ queryBuilder -> andWhere ( $ queryBuilder -> expr ( ) -> eq ( 'tl_version.pid' , ':pid' )...
Save a new version of a row .
42,680
public function setVersionActive ( $ mixID , $ mixVersion ) { $ updateValues = [ 'tl_version.pid' => $ mixID , 'tl_version.fromTable' => $ this -> source ] ; $ this -> connection -> update ( 'tl_version' , [ 'tl_version.active' => '' ] , $ updateValues ) ; $ updateValues [ 'version' ] = $ mixVersion ; $ this -> connect...
Set a version as active .
42,681
public function getActiveVersion ( $ mixID ) { $ queryBuilder = $ this -> connection -> createQueryBuilder ( ) ; $ queryBuilder -> select ( [ 'select' ] ) ; $ queryBuilder -> from ( 'tl_version' ) ; $ queryBuilder -> andWhere ( $ queryBuilder -> expr ( ) -> eq ( 'tl_version.pid' , ':pid' ) ) ; $ queryBuilder -> setPara...
Retrieve the current active version for a row .
42,682
public function sameModels ( $ firstModel , $ secondModel ) { foreach ( $ firstModel as $ key => $ value ) { if ( $ key === $ this -> idProperty ) { continue ; } if ( \ is_array ( $ value ) ) { if ( ! \ is_array ( $ secondModel -> getProperty ( $ key ) ) ) { return false ; } if ( \ serialize ( $ value ) !== \ serialize...
Check if two models have the same values in all properties .
42,683
protected function insertUndo ( $ sourceSQL , $ saveSQL , $ table ) { $ statement = $ this -> connection -> query ( $ saveSQL ) ; if ( 0 === $ statement -> rowCount ( ) ) { return ; } $ result = $ statement -> fetch ( \ PDO :: FETCH_ASSOC ) ; $ parameters = [ ] ; foreach ( $ result as $ value ) { $ parameters [ $ table...
Store an undo entry in the table tl_undo .
42,684
private function fallbackFromDatabaseToConnection ( array & $ config ) { if ( isset ( $ config [ 'database' ] ) ) { @ \ trigger_error ( 'Config key database is deprecated use instead connection. Fallback will be dropped.' , E_USER_DEPRECATED ) ; if ( ! isset ( $ config [ 'connection' ] ) ) { $ config [ 'connection' ] =...
This is a fallback for get the connection instead of the old database .
42,685
private function addParentFilter ( $ idParent , $ config ) { $ environment = $ this -> getEnvironment ( ) ; $ definition = $ environment -> getDataDefinition ( ) ; $ providerName = $ definition -> getBasicDefinition ( ) -> getDataProvider ( ) ; $ parentProviderName = $ idParent -> getDataProviderName ( ) ; $ parentProv...
Add the filter for the item with the given id from the parent data provider to the given config .
42,686
protected function getGet ( $ key , $ decodeEntities = false ) { return $ this -> getEnvironment ( ) -> getInputProvider ( ) -> getParameter ( $ key , $ decodeEntities ) ; }
Compat wrapper for contao 2 . X and 3 . X - delegates to the relevant input handler .
42,687
protected function getPost ( $ key , $ decodeEntities = false ) { return $ this -> getEnvironment ( ) -> getInputProvider ( ) -> getValue ( $ key , $ decodeEntities ) ; }
Compatibility wrapper for contao 2 . X and 3 . X - delegates to the relevant input handler .
42,688
protected function loadStructure ( ) { $ response = new Response ( $ this -> getDataContainer ( ) -> ajaxTreeView ( $ this -> getAjaxId ( ) , ( int ) $ this -> getPost ( 'level' ) ) ) ; throw new ResponseException ( $ response ) ; }
Load a tree structure .
42,689
protected function loadFileManager ( ) { $ response = new Response ( $ this -> getDataContainer ( ) -> ajaxTreeView ( $ this -> getPost ( 'folder' , true ) , ( int ) $ this -> getPost ( 'level' ) ) ) ; throw new ResponseException ( $ response ) ; }
Load a file manager tree structure .
42,690
public function executePostActions ( DataContainerInterface $ container ) { \ header ( 'Content-Type: text/html; charset=' . $ GLOBALS [ 'TL_CONFIG' ] [ 'characterSet' ] ) ; $ this -> objDc = $ container ; $ action = $ this -> getEnvironment ( ) -> getInputProvider ( ) -> getValue ( 'action' ) ; if ( \ in_array ( $ act...
Handle the post actions from DcGeneral .
42,691
protected function exitScript ( ) { @ \ trigger_error ( 'Use own response exit!' , E_USER_DEPRECATED ) ; $ session = System :: getContainer ( ) -> get ( 'session' ) ; $ sessionBag = $ session -> getBag ( 'contao_backend' ) -> all ( ) ; $ user = BackendUser :: getInstance ( ) ; Database :: getInstance ( ) -> prepare ( '...
Convenience method to exit the script .
42,692
protected function addServers ( $ cache , $ servers ) { $ existingServers = [ ] ; if ( $ this -> persistentId !== null ) { foreach ( $ cache -> getServerList ( ) as $ s ) { $ existingServers [ $ s [ 'host' ] . ':' . $ s [ 'port' ] ] = true ; } } foreach ( $ servers as $ server ) { if ( empty ( $ existingServers ) || ! ...
Add servers to the server pool of the cache specified
42,693
public function getMemcached ( ) { if ( $ this -> _cache === null ) { if ( ! extension_loaded ( 'memcached' ) ) { throw new InvalidConfigException ( 'MemCached requires PHP memcached extension to be loaded.' ) ; } $ this -> _cache = $ this -> persistentId !== null ? new \ Memcached ( $ this -> persistentId ) : new \ Me...
Returns the underlying memcached object .
42,694
protected function getTablenameCallback ( $ tableName ) { if ( isset ( $ GLOBALS [ 'TL_DCA' ] [ $ tableName ] [ 'config' ] [ 'tablename_callback' ] ) && \ is_array ( $ GLOBALS [ 'TL_DCA' ] [ $ tableName ] [ 'config' ] [ 'tablename_callback' ] ) ) { foreach ( $ GLOBALS [ 'TL_DCA' ] [ $ tableName ] [ 'config' ] [ 'tablen...
Call the table name callback .
42,695
protected function callAction ( ) { $ environment = $ this -> getEnvironment ( ) ; $ action = new Action ( $ environment -> getInputProvider ( ) -> getParameter ( 'act' ) ? : 'showAll' ) ; return $ environment -> getController ( ) -> handle ( $ action ) ; }
Call the desired user action with an implicit fallback to the showAll action when none has been requested .
42,696
private function determineFilterConfig ( AbstractModelAwareEvent $ event ) { $ environment = $ event -> getEnvironment ( ) ; $ model = $ event -> getModel ( ) ; $ dataProvider = $ environment -> getDataProvider ( $ model -> getProviderName ( ) ) ; $ definition = $ environment -> getDataDefinition ( ) ; $ relationship =...
Determine the filter config to use .
42,697
protected function makeName ( $ information ) { if ( $ information instanceof DataProviderInformationInterface ) { $ information = $ information -> getName ( ) ; } if ( ! \ is_string ( $ information ) ) { throw new DcGeneralInvalidArgumentException ( 'Invalid value passed.' ) ; } return $ information ; }
Convert a value into a data definition name .
42,698
public function handleFormatModelLabel ( FormatModelLabelEvent $ event ) { if ( ! $ this -> scopeDeterminator -> currentScopeIsBackend ( ) ) { return ; } $ environment = $ event -> getEnvironment ( ) ; $ model = $ event -> getModel ( ) ; $ dataDefinition = $ environment -> getDataDefinition ( ) ; $ viewSection = $ data...
Default handler for formatting a model .
42,699
private function getFirstSorting ( GroupAndSortingDefinitionInterface $ sortingDefinition = null ) { if ( null === $ sortingDefinition ) { return '' ; } foreach ( $ sortingDefinition as $ information ) { if ( $ information -> getProperty ( ) ) { return $ information -> getProperty ( ) ; } } return '' ; }
Retrieve the first sorting value .