_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q244900 | CustomSql.getSubscribedServices | validation | public static function getSubscribedServices()
{
return [
Connection::class => Connection::class,
Input::class => Input::class,
InsertTags::class => InsertTags::class,
Session::class => Session::class,
// This one is deprecated.
... | php | {
"resource": ""
} |
q244901 | CustomSql.getFilterRule | validation | private function getFilterRule()
{
$this->compile();
return new SimpleQuery(
$this->queryString,
$this->queryParameter,
'id',
$this->container->get(Connection::class)
);
} | php | {
"resource": ""
} |
q244902 | CustomSql.addParameters | validation | private function addParameters($parameters)
{
if (empty($parameters)) {
return;
}
$this->queryParameter = array_merge($this->queryParameter, $parameters);
} | php | {
"resource": ""
} |
q244903 | CustomSql.parseTable | validation | private function parseTable()
{
$this->queryString = str_replace(
'{{table}}',
$this->collection->getMetaModel()->getTableName(),
$this->queryString
);
} | php | {
"resource": ""
} |
q244904 | CustomSql.getValueFromServiceContainer | validation | private function getValueFromServiceContainer($valueName, $arguments)
{
if (!empty($arguments['service'])) {
$serviceName = $arguments['service'];
} else {
$serviceName = $valueName;
}
$service = $this->container->get(IMetaModelsServiceContainer::class)->getS... | php | {
"resource": ""
} |
q244905 | CustomSql.getValueFromSource | validation | private function getValueFromSource($source, $valueName, $arguments)
{
switch (strtolower($source)) {
case 'get':
return $this->container->get(Input::class)->get($valueName);
case 'post':
return $this->container->get(Input::class)->post($valueName);
... | php | {
"resource": ""
} |
q244906 | CustomSql.convertParameterAggregate | validation | private function convertParameterAggregate($var, $arguments)
{
// Treat as list.
$var = (array) $var;
if (!empty($arguments['recursive'])) {
$var = iterator_to_array(
new \RecursiveIteratorIterator(
new \RecursiveArrayIterator(
... | php | {
"resource": ""
} |
q244907 | CustomSql.convertParameter | validation | public function convertParameter($arrMatch)
{
list($strSource, $strQuery) = explode('?', $arrMatch[1], 2);
parse_str($strQuery, $arrArgs);
$arrName = (array) $arrArgs['name'];
$var = $this->getValueFromSource($strSource, array_shift($arrName), $arrArgs);
$index = 0;
... | php | {
"resource": ""
} |
q244908 | ConnectionTrait.getRow | validation | private function getRow($rowId, $table)
{
return (object) $this->connection
->createQueryBuilder()
->select('*')
->from($table)
->where('id=:id')
->setParameter('id', $rowId)
->setMaxResults(1)
->execute()
->fetc... | php | {
"resource": ""
} |
q244909 | FilterUrlBuilder.generate | validation | public function generate(FilterUrl $filterUrl)
{
$jumpTo = $filterUrl->getPage();
// If no alias given, stay on current page.
if (empty($jumpTo['alias'])) {
$this->addFromCurrentRequest($filterUrl = $filterUrl->clone(), []);
$jumpTo = $filterUrl->getPage();
... | php | {
"resource": ""
} |
q244910 | FilterUrlBuilder.getCurrentFilterUrl | validation | public function getCurrentFilterUrl($options = null): FilterUrl
{
$this->addFromCurrentRequest($filterUrl = new FilterUrl(), $options);
return $filterUrl;
} | php | {
"resource": ""
} |
q244911 | FilterUrlBuilder.determineFragments | validation | private function determineFragments(Request $request): ?array
{
if (null === $requestUri = $this->strippedUri($request)) {
return null;
}
$fragments = null;
// Use folder-style URLs
if (Config::get('folderUrl') && false !== strpos($requestUri, '/')) {
... | php | {
"resource": ""
} |
q244912 | FilterUrlBuilder.getFolderUrlFragments | validation | private function getFolderUrlFragments(string $alias, string $host, string $locale = null): ?array
{
// Check if there are pages with a matching alias
$pages = $this->getPageCandidates($alias);
if (null === $pages) {
return null;
}
// Look for a root page whose d... | php | {
"resource": ""
} |
q244913 | FilterUrlBuilder.getPageCandidates | validation | private function getPageCandidates(string $alias)
{
$aliases = [$alias];
// Compile all possible aliases by applying dirname() to the request.
while ('/' !== $alias && false !== strpos($alias, '/')) {
$alias = \dirname($alias);
$aliases[] = $alias;
}
... | php | {
"resource": ""
} |
q244914 | FilterUrlBuilder.getPageIdFromUrlHook | validation | private function getPageIdFromUrlHook(?array $fragments): ?array
{
if (!(isset($GLOBALS['TL_HOOKS']['getPageIdFromUrl']) && \is_array($GLOBALS['TL_HOOKS']['getPageIdFromUrl']))) {
return $fragments;
}
foreach ($GLOBALS['TL_HOOKS']['getPageIdFromUrl'] as $callback) {
$... | php | {
"resource": ""
} |
q244915 | FilterUrlBuilder.extractPostData | validation | private function extractPostData(FilterUrl $filterUrl, $options, Request $request): void
{
if (empty($options['postAsSlug']) && empty($options['postAsGet'])) {
return;
}
foreach ($request->request->all() as $name => $value) {
if (is_array($value)) {
$... | php | {
"resource": ""
} |
q244916 | CollectFactoriesPass.collectAttributeFactories | validation | private function collectAttributeFactories($container)
{
$attributeFactory = $container->getDefinition('metamodels.attribute_factory');
foreach (array_keys($container->findTaggedServiceIds(self::TAG_ATTRIBUTE_FACTORY)) as $factory) {
$attributeFactory->addMethodCall('addTypeFactory', [ne... | php | {
"resource": ""
} |
q244917 | TableManipulator.checkColumnDoesNotExist | validation | public function checkColumnDoesNotExist($strTableName, $strColName, $blnAllowSystemCol = false)
{
$this->checkTableExists($strTableName);
$this->checkColumnName($strColName, $blnAllowSystemCol);
if ($this->fieldExists($strColName, $strTableName)) {
throw ColumnExistsException::w... | php | {
"resource": ""
} |
q244918 | TableManipulator.fieldExists | validation | private function fieldExists($strTableName, $strColumnName)
{
$columns = $this->connection->getSchemaManager()->listTableColumns($strTableName);
return isset($columns[$strColumnName]);
} | php | {
"resource": ""
} |
q244919 | FileSelectorWidget.generateAjax | validation | public function generateAjax($folder, $strField, $level, $mount = false)
{
return parent::generateAjax($folder, $this->strField, $level, $mount);
} | php | {
"resource": ""
} |
q244920 | UserListener.buildBackendModules | validation | private function buildBackendModules(&$localMenu)
{
foreach ($this->viewCombination->getStandalone() as $metaModelName => $screen) {
$section = $screen['meta']['backendsection'];
if (!isset($localMenu[$section])) {
$localMenu[$section] = [];
}
... | php | {
"resource": ""
} |
q244921 | UserListener.injectChildTables | validation | private function injectChildTables(&$localMenu)
{
$parented = $this->viewCombination->getParented();
$lastCount = count($parented);
while ($parented) {
foreach ($parented as $metaModelName => $child) {
foreach ($localMenu as $groupName => $modules) {
... | php | {
"resource": ""
} |
q244922 | HybridFilterBlock.getJumpTo | validation | public function getJumpTo()
{
if (!isset($this->arrJumpTo)) {
/** @var \Database\Result $page */
$page = $GLOBALS['objPage'];
$this->setJumpTo($page->row());
if ($this->metamodel_jumpTo) {
// Page to jump to when filter submit.
... | php | {
"resource": ""
} |
q244923 | HybridFilterBlock.getFilterFactory | validation | private function getFilterFactory(): IFilterSettingFactory
{
if (null === $this->filterFactory) {
return $this->filterFactory = System::getContainer()->get('metamodels.filter_setting_factory');
}
return $this->filterFactory;
} | php | {
"resource": ""
} |
q244924 | HybridFilterBlock.getFilterUrlBuilder | validation | private function getFilterUrlBuilder(): FilterUrlBuilder
{
if (null === $this->filterUrlBuilder) {
return $this->filterUrlBuilder = System::getContainer()->get('metamodels.filter_url');
}
return $this->filterUrlBuilder;
} | php | {
"resource": ""
} |
q244925 | FilterBuilder.buildNativeSqlProcedure | validation | protected function buildNativeSqlProcedure(FilterBuilderSql $procedure, $children)
{
$skipped = array();
$metaModel = $this->getMetaModel();
$tableName = $metaModel->getTableName();
foreach ($children as $child) {
// If there is an attribute contained within this rule, ... | php | {
"resource": ""
} |
q244926 | FilterBuilder.optimizedFilter | validation | protected function optimizedFilter($filterRule, $children, $operation)
{
$procedure = new FilterBuilderSql($this->getMetaModel()->getTableName(), $operation, $this->connection);
$skipped = $this->buildNativeSqlProcedure($procedure, $children);
if (!$procedure->isEmpty()) {
$fi... | php | {
"resource": ""
} |
q244927 | FilterBuilder.getAndOrFilter | validation | protected function getAndOrFilter(IFilter $filter, $operation)
{
if (!$operation['children']) {
return;
}
if ($operation['operation'] == 'AND') {
$filterRule = new ConditionAnd();
} else {
$filterRule = new ConditionOr();
}
$filter... | php | {
"resource": ""
} |
q244928 | FilterBuilder.getAttributeFromFilterOperation | validation | protected function getAttributeFromFilterOperation($operation)
{
$attribute = null;
if (!empty($operation['property'])) {
$attribute = $this->getMetaModel()->getAttribute($operation['property']);
}
if ($attribute === null) {
throw new \InvalidArgumentExceptio... | php | {
"resource": ""
} |
q244929 | FilterBuilder.calculateSubfilter | validation | private function calculateSubfilter($operation, IFilter $filter)
{
if (!is_array($operation)) {
throw new \RuntimeException('Error Processing subfilter: ' . var_export($operation, true), 1);
}
switch ($operation['operation']) {
case 'AND':
case 'OR':
... | php | {
"resource": ""
} |
q244930 | CreateVariantButtonListener.createButton | validation | public function createButton(GetOperationButtonEvent $event)
{
if ('createvariant' !== $event->getCommand()->getName()) {
return;
}
/** @var Model $model */
$model = $event->getModel();
$metamodel = $model->getItem()->getMetaModel();
if (!$metamodel->... | php | {
"resource": ""
} |
q244931 | CreateVariantButtonListener.handleCreateVariantAction | validation | public function handleCreateVariantAction(ActionEvent $event)
{
if (false === $this->scopeMatcher->currentScopeIsBackend()
|| 'createvariant' !== $event->getAction()->getName()) {
return;
}
$environment = $event->getEnvironment();
$view = $environm... | php | {
"resource": ""
} |
q244932 | CreateVariantButtonListener.presetVariantBase | validation | public function presetVariantBase(PreEditModelEvent $event)
{
$model = $event->getModel();
// Check of we have the driver from MetaModels. Only these request are from interest.
if (!$model instanceof Model) {
return;
}
// Get the item and check the context.
... | php | {
"resource": ""
} |
q244933 | CreateVariantButtonListener.breadcrumb | validation | protected function breadcrumb(EnvironmentInterface $environment)
{
$event = new GetBreadcrumbEvent($environment);
$environment->getEventDispatcher()->dispatch($event::NAME, $event);
$arrReturn = $event->getElements();
if (!is_array($arrReturn) || count($arrReturn) == 0) {
... | php | {
"resource": ""
} |
q244934 | AttributeFactory.createAttribute | validation | public function createAttribute($information, $metaModel)
{
$event = new CreateAttributeEvent($information, $metaModel);
$this->eventDispatcher->dispatch(CreateAttributeEvent::NAME, $event);
if ($event->getAttribute()) {
return $event->getAttribute();
}
$factory... | php | {
"resource": ""
} |
q244935 | AbstractBreadcrumbListener.getBreadcrumb | validation | public function getBreadcrumb(GetBreadcrumbEvent $event)
{
$environment = $event->getEnvironment();
if (!$this->wantToHandle($event)) {
return;
}
$elements = $this->storeFactory->createStore();
$this->getBreadcrumbElements($environment, $elements);
$event... | php | {
"resource": ""
} |
q244936 | AbstractBreadcrumbListener.getBreadcrumbElements | validation | protected function getBreadcrumbElements(EnvironmentInterface $environment, BreadcrumbStore $elements)
{
if ($this->parent) {
$this->parent->getBreadcrumbElements($environment, $elements);
}
} | php | {
"resource": ""
} |
q244937 | AbstractBreadcrumbListener.extractIdFrom | validation | protected function extractIdFrom(EnvironmentInterface $environment, $parameterName = 'pid')
{
$parameter = $environment->getInputProvider()->getParameter($parameterName);
return ModelId::fromSerialized($parameter)->getId();
} | php | {
"resource": ""
} |
q244938 | PurgeListener.checkPurge | validation | public function checkPurge(AbstractModelAwareEvent $event)
{
$table = $event->getModel()->getProviderName();
if (($table == 'tl_metamodel') ||
($table == 'tl_metamodel_dca') ||
($table == 'tl_metamodel_dca_sortgroup') ||
($table == 'tl_metamodel_dcasetting') ||
... | php | {
"resource": ""
} |
q244939 | Contao2BackendViewDefinitionBuilder.getOrCreateDefinition | validation | private function getOrCreateDefinition()
{
if ($this->container->hasDefinition(Contao2BackendViewDefinitionInterface::NAME)) {
$view = $this->container->getDefinition(Contao2BackendViewDefinitionInterface::NAME);
if (!$view instanceof Contao2BackendViewDefinitionInterface) {
... | php | {
"resource": ""
} |
q244940 | Contao2BackendViewDefinitionBuilder.parseListing | validation | private function parseListing()
{
$listing = $this->definition->getListingConfig();
if (null === $listing->getRootLabel()) {
$listing->setRootLabel($this->metaModel->get('name'));
}
if (null === $listing->getRootIcon()) {
$listing->setRootIcon($this->iconBui... | php | {
"resource": ""
} |
q244941 | Contao2BackendViewDefinitionBuilder.handleSorting | validation | private function handleSorting(
$information,
GroupAndSortingDefinitionInterface $definition
) {
if ($information['ismanualsort']) {
$definition
->add()
->setManualSorting()
->setProperty('sorting')
->setSortingMode(... | php | {
"resource": ""
} |
q244942 | Contao2BackendViewDefinitionBuilder.convertRenderGroupType | validation | private function convertRenderGroupType($type)
{
$lookup = [
'char' => GroupAndSortingInformationInterface::GROUP_CHAR,
'digit' => GroupAndSortingInformationInterface::GROUP_DIGIT,
'day' => GroupAndSortingInformationInterface::GROUP_DAY,
'weekday' => ... | php | {
"resource": ""
} |
q244943 | AbstractPaletteRestrictionListener.getLegend | validation | protected function getLegend($name, $palette, $prevLegend = null)
{
if (strpos($name, '+') === 0) {
$name = substr($name, 1);
}
if (!$palette->hasLegend($name)) {
$palette->addLegend(new Legend($name), $prevLegend);
}
return $palette->getLegend($name... | php | {
"resource": ""
} |
q244944 | AbstractPaletteRestrictionListener.getProperty | validation | protected function getProperty($name, $legend)
{
foreach ($legend->getProperties() as $property) {
if ($property->getName() === $name) {
return $property;
}
}
$property = new Property($name);
$legend->addProperty($property);
return $p... | php | {
"resource": ""
} |
q244945 | DuplicateModel.handle | validation | public function handle(PreDuplicateModelEvent $event)
{
$model = $event->getModel();
$metaModel = $this->factory->getMetaModel($model->getProviderName());
if (!$metaModel || !$metaModel->hasVariants()) {
return;
}
// If we have a varbase, reset the vargroup bec... | php | {
"resource": ""
} |
q244946 | AttributeAddingListener.handle | validation | public function handle(CreateMetaModelEvent $event)
{
if (null === $metaModel = $event->getMetaModel()) {
return;
}
foreach ($this->attributeFactory->createAttributesForMetaModel($metaModel) as $attribute) {
$metaModel->addAttribute($attribute);
}
} | php | {
"resource": ""
} |
q244947 | FrontendFilter.getMetaModelFrontendFilter | validation | public function getMetaModelFrontendFilter(HybridFilterBlock $objFilterConfig)
{
$this->objFilterConfig = $objFilterConfig;
$this->formId .= $this->objFilterConfig->id;
return $this->getFilters();
} | php | {
"resource": ""
} |
q244948 | FrontendFilter.renderWidget | validation | protected function renderWidget($widget, $filterOptions)
{
$filter = $widget;
$templateName = $filter['raw']['eval']['template'];
$template = new \FrontendTemplate($templateName ? $templateName : 'mm_filteritem_default');
$template->setData($filter);
$template->su... | php | {
"resource": ""
} |
q244949 | FrontendFilter.checkRedirect | validation | protected function checkRedirect($widgets, $wantedParameter, $allParameter)
{
// @codingStandardsIgnoreStart
@trigger_error(
sprintf('"%1$s" has been deprecated in favor of the new "FilterUrlBuilder"', __METHOD__),
E_USER_DEPRECATED
);
// @codingStandardsIgnor... | php | {
"resource": ""
} |
q244950 | FrontendFilter.getFrontendFilterOptions | validation | protected function getFrontendFilterOptions()
{
$objFrontendFilterOptions = new FrontendFilterOptions();
$objFrontendFilterOptions->setAutoSubmit($this->objFilterConfig->metamodel_fef_autosubmit ? true : false);
$objFrontendFilterOptions->setHideClearFilter(
$this->objFilterConfi... | php | {
"resource": ""
} |
q244951 | FrontendFilter.getFilters | validation | protected function getFilters()
{
$filterOptions = $this->getFrontendFilterOptions();
$jumpToInformation = $this->objFilterConfig->getJumpTo();
$filterSetting = $this->objFilterConfig->getFilterCollection();
$wantedNames = $this->getWantedNames();
$this->buildP... | php | {
"resource": ""
} |
q244952 | FrontendFilter.generateElement | validation | protected function generateElement($table, $content, $replace, $elementId)
{
$sql = sprintf('SELECT * FROM %s WHERE id=? AND type="metamodels_frontendclearall"', $table);
$statement = $this->connection->prepare($sql);
$statement->bindValue(1, $elementId);
$statement->execute();
... | php | {
"resource": ""
} |
q244953 | FrontendFilter.generateClearAll | validation | public function generateClearAll($strContent, $strTemplate)
{
if (substr($strTemplate, 0, 3) === 'fe_') {
if (preg_match_all(
'#\[\[\[metamodelfrontendfilterclearall::(ce|mod)::([^\]]*)\]\]\]#',
$strContent,
$arrMatches,
PREG_SET_OR... | php | {
"resource": ""
} |
q244954 | AbstractFilterSettingTypeFactory.isNestedType | validation | public function isNestedType()
{
if (!isset($this->isNestedType)) {
$this->isNestedType = in_array(
'MetaModels\Filter\Setting\IWithChildren',
class_implements($this->typeClass, true)
);
}
return $this->isNestedType;
} | php | {
"resource": ""
} |
q244955 | AbstractFilterSettingTypeFactory.allowAttributeTypes | validation | protected function allowAttributeTypes($initialType1toN = null)
{
if (is_array($initialType1toN)) {
$this->attributeTypes = $initialType1toN;
} else {
$this->attributeTypes = func_get_args();
}
return $this;
} | php | {
"resource": ""
} |
q244956 | AbstractFilterSettingTypeFactory.addKnownAttributeType | validation | public function addKnownAttributeType($typeName)
{
if (!is_array($this->attributeTypes)) {
throw new \LogicException('Filter setting ' . $this->typeClass . ' can not handle attributes.');
}
$this->attributeTypes[$typeName] = $typeName;
return $this;
} | php | {
"resource": ""
} |
q244957 | TypeOptionsListener.handle | validation | public function handle(GetPropertyOptionsEvent $event)
{
if (!$this->wantToHandle($event)) {
return;
}
$options = [];
foreach ($this->conditionFactory->getTypeNames() as $condition) {
$options[$condition] = $this->translator->trans(
'tl_metamo... | php | {
"resource": ""
} |
q244958 | ColumnExistsException.withName | validation | public static function withName($columnName, $tableName, $code = 0, $previous = null)
{
return new static(
sprintf('Column "%s" already exists on table "%s', $columnName, $tableName),
$code,
$previous
);
} | php | {
"resource": ""
} |
q244959 | AbstractListener.getMetaModelFromModel | validation | protected function getMetaModelFromModel(ModelInterface $model)
{
if (!(($model->getProviderName() == 'tl_metamodel_dca_sortgroup') && $model->getProperty('pid'))) {
throw new DcGeneralInvalidArgumentException(
sprintf(
'Model must originate from tl_metamodel_... | php | {
"resource": ""
} |
q244960 | GetAttributeTypeListener.wantToHandle | validation | protected function wantToHandle(AbstractEnvironmentAwareEvent $event)
{
/** @var GetPropertyOptionsEvent $event */
if (!parent::wantToHandle($event)) {
return false;
}
if ($event->getPropertyName() !== 'type') {
return false;
}
$request = $thi... | php | {
"resource": ""
} |
q244961 | MultiTextWidget.validator | validation | protected function validator($varInput)
{
if (is_array($varInput)) {
$value = array();
foreach ($varInput as $key => $input) {
$value[$key] = parent::validator($input);
}
return $value;
}
return parent::validator(trim($varInpu... | php | {
"resource": ""
} |
q244962 | TableUpdatingListener.handleDelete | validation | public function handleDelete(PreDeleteModelEvent $event)
{
if (!$this->wantToHandle($event)) {
return;
}
try {
$this->tableManipulator->checkTableExists($tableName = $event->getModel()->getProperty('tableName'));
} catch (\Exception $exception) {
... | php | {
"resource": ""
} |
q244963 | TableUpdatingListener.handleUpdate | validation | public function handleUpdate(PostPersistModelEvent $event)
{
if (!$this->wantToHandle($event)) {
return;
}
$old = $event->getOriginalModel();
$new = $event->getModel();
$oldTable = $old ? $old->getProperty('tableName') : null;
$newTable = $new->... | php | {
"resource": ""
} |
q244964 | CollectMetaModelTableNamesEvent.addMetaModelNames | validation | public function addMetaModelNames($metaModelNames)
{
$this->metaModelNames = array_unique(array_merge($this->metaModelNames, $metaModelNames));
return $this;
} | php | {
"resource": ""
} |
q244965 | MetaModelsCoreExtension.buildCacheService | validation | private function buildCacheService(ContainerBuilder $container, array $config)
{
// if cache disabled, swap it out with the dummy cache.
if (!$config['enable_cache']) {
$cache = $container->getDefinition('metamodels.cache');
$cache->setClass(ArrayCache::class);
$c... | php | {
"resource": ""
} |
q244966 | MetaModelsCoreExtension.buildPickerService | validation | private function buildPickerService(ContainerBuilder $container)
{
$pickerService = $container->getDefinition('metamodels.controller.picker');
$configs = $pickerService->getArgument(2);
// Selectable styles in the palette tl_class definitions.
$configs['PALETTE_STYLE_PICKER'][... | php | {
"resource": ""
} |
q244967 | SimpleQuery.createFromQueryBuilder | validation | public static function createFromQueryBuilder(QueryBuilder $builder, $columnName = 'id')
{
return new self(
$builder->getSQL(),
$builder->getParameters(),
$columnName,
$builder->getConnection(),
$builder->getParameterTypes()
);
} | php | {
"resource": ""
} |
q244968 | SimpleQuery.sanitizeConnection | validation | private function sanitizeConnection($connection)
{
if ($connection instanceof Connection) {
return $connection;
}
// BC layer - we used to accept a Contao database instance here.
if ($connection instanceof Database) {
// @codingStandardsIgnoreStart
... | php | {
"resource": ""
} |
q244969 | MetaModel.tryUnserialize | validation | protected function tryUnserialize($value)
{
if (!is_array($value)
&& 0 === strpos($value, 'a:')
&& is_array($unSerialized = unserialize($value, ['allowed_classes' => false]))) {
return $unSerialized;
}
return $value;
} | php | {
"resource": ""
} |
q244970 | MetaModel.getAttributeImplementing | validation | protected function getAttributeImplementing($interface)
{
$result = array();
foreach ($this->getAttributes() as $colName => $attribute) {
if ($attribute instanceof $interface) {
$result[$colName] = $attribute;
}
}
return $result;
} | php | {
"resource": ""
} |
q244971 | MetaModel.getMatchingIds | validation | protected function getMatchingIds($objFilter)
{
if ($objFilter) {
$arrFilteredIds = $objFilter->getMatchingIds();
if ($arrFilteredIds !== null) {
return $arrFilteredIds;
}
}
// Either no filter object or all ids allowed => return all ids.
... | php | {
"resource": ""
} |
q244972 | MetaModel.fetchRows | validation | protected function fetchRows($arrIds, $arrAttrOnly = array())
{
/** @var QueryBuilder $builder */
$builder = $this->getConnection()->createQueryBuilder();
$query = $builder
->select('*')
->from($this->getTableName())
->where($builder->expr()->in('id', ':... | php | {
"resource": ""
} |
q244973 | MetaModel.copyFilter | validation | protected function copyFilter($objFilter)
{
if ($objFilter) {
$objNewFilter = $objFilter->createCopy();
} else {
$objNewFilter = $this->getEmptyFilter();
}
return $objNewFilter;
} | php | {
"resource": ""
} |
q244974 | MetaModel.getAttributeByNames | validation | protected function getAttributeByNames($attrNames = array())
{
if (empty($attrNames)) {
return $this->arrAttributes;
}
$result = array();
foreach ($attrNames as $attributeName) {
$result[$attributeName] = $this->arrAttributes[$attributeName];
}
... | php | {
"resource": ""
} |
q244975 | MetaModel.saveSimpleColumn | validation | protected function saveSimpleColumn($strColumn, $arrIds, $varData)
{
if (is_array($varData)) {
$varData = serialize($varData);
}
$builder = $this->getConnection()->createQueryBuilder();
$builder
->update($this->getTableName(), 'v2')
->set('v2.' .... | php | {
"resource": ""
} |
q244976 | MetaModel.saveAttribute | validation | protected function saveAttribute($objAttribute, $arrIds, $varData, $strLangCode)
{
// Call the serializeData for all simple attributes.
if ($this->isSimpleAttribute($objAttribute)) {
/** @var \MetaModels\Attribute\ISimple $objAttribute */
$varData = $objAttribute->serializeDa... | php | {
"resource": ""
} |
q244977 | MetaModel.updateVariants | validation | protected function updateVariants($item, $activeLanguage, $allIds, $baseAttributes = false)
{
foreach ($this->getAttributes() as $strAttributeId => $objAttribute) {
// Skip unset attributes.
if (!$item->isAttributeSet($objAttribute->getColName())) {
continue;
... | php | {
"resource": ""
} |
q244978 | MetaModel.createNewItem | validation | protected function createNewItem($item)
{
$data = ['tstamp' => $item->get('tstamp')];
$isNewItem = false;
if ($this->hasVariants()) {
// No variant group is given, so we have a complete new base item this should be a workaround for these
// values should be set b... | php | {
"resource": ""
} |
q244979 | MetaModel.getConnection | validation | private function getConnection()
{
if ($this->connection) {
return $this->connection;
}
$reflection = new \ReflectionProperty(\Contao\Database::class, 'resConnection');
$reflection->setAccessible(true);
return $this->connection = $reflection->getValue($this->get... | php | {
"resource": ""
} |
q244980 | MetaModel.saveBaseColumns | validation | private function saveBaseColumns(IItem $item, $timestamp)
{
$isNew = false;
$item->set('tstamp', $timestamp);
if (!$item->get('id')) {
$isNew = true;
$this->createNewItem($item);
}
// Update system columns.
if (null !== $item->get('pid')) {
... | php | {
"resource": ""
} |
q244981 | ViewCombinationBuilder.getCombinationsForUser | validation | public function getCombinationsForUser($userGroups, $userType)
{
$userType = strtolower($userType);
if ('fe' !== $userType && 'be' !== $userType) {
throw new \InvalidArgumentException('Unknown user type: ' . $userType);
}
return $this->getCombinationsFromDatabase($userGr... | php | {
"resource": ""
} |
q244982 | FilterSettingTypeRendererCore.getLabelParameters | validation | protected function getLabelParameters(EnvironmentInterface $environment, ModelInterface $model)
{
if ($model->getProperty('type') == 'simplelookup') {
return $this->getLabelParametersWithAttributeAndUrlParam($environment, $model);
}
return $this->getLabelParametersNormal($environ... | php | {
"resource": ""
} |
q244983 | Driver.delete | validation | public function delete($varItem)
{
// Determine the id.
if (is_object($varItem) && ($varItem instanceof Model)) {
$objModelItem = $varItem->getItem();
} else {
$objModelItem = $this->getMetaModel()->findById($varItem);
}
if ($objModelItem) {
... | php | {
"resource": ""
} |
q244984 | Driver.setLanguage | validation | protected function setLanguage($language = '')
{
$previousLanguage = $GLOBALS['TL_LANGUAGE'];
if (!empty($language) && ($GLOBALS['TL_LANGUAGE'] !== $language)) {
$GLOBALS['TL_LANGUAGE'] = $language;
}
return $previousLanguage;
} | php | {
"resource": ""
} |
q244985 | Driver.getMetaModel | validation | protected function getMetaModel()
{
if (!$this->metaModel) {
if ($this->metaModel === null) {
throw new \RuntimeException('No MetaModel instance set for ' . $this->strTable);
}
}
return $this->metaModel;
} | php | {
"resource": ""
} |
q244986 | Driver.fetch | validation | public function fetch(ConfigInterface $objConfig)
{
$backupLanguage = $this->setLanguage($this->getCurrentLanguage());
if ($objConfig->getId() !== null) {
$modelId = $objConfig->getId();
} else {
$filter = $this->prepareFilter($objConfig);
$ids = $th... | php | {
"resource": ""
} |
q244987 | Driver.setBaseConfig | validation | public function setBaseConfig(array $arrConfig)
{
if (!$arrConfig['source']) {
throw new \RuntimeException('Missing table name.');
}
$this->strTable = $arrConfig['source'];
$this->metaModel = $arrConfig['metaModel'];
} | php | {
"resource": ""
} |
q244988 | Driver.extractSorting | validation | protected function extractSorting($config)
{
$sorting = $config->getSorting();
$sortBy = key($sorting);
$sortDir = current($sorting) ?: DCGE::MODEL_SORTING_ASC;
return array($sortBy, $sortDir);
} | php | {
"resource": ""
} |
q244989 | Driver.getIdsFromFilter | validation | protected function getIdsFromFilter($filter, $config)
{
$sorting = $this->extractSorting($config);
return $this->getMetaModel()->getIdsFromFilter(
$filter,
$sorting[0],
$config->getStart(),
$config->getAmount(),
strtoupper($sorting[1])
... | php | {
"resource": ""
} |
q244990 | Driver.getItemsFromFilter | validation | protected function getItemsFromFilter($filter, $config)
{
$sorting = $this->extractSorting($config);
return $this->getMetaModel()->findByFilter(
$filter,
$sorting[0],
$config->getStart(),
$config->getAmount(),
strtoupper($sorting[1]),
... | php | {
"resource": ""
} |
q244991 | Driver.getFilterOptions | validation | public function getFilterOptions(ConfigInterface $objConfig)
{
$arrProperties = $objConfig->getFields();
if (count($arrProperties) <> 1) {
throw new \RuntimeException('objConfig must contain exactly one property to be retrieved.');
}
$objFilter = $this->prepareFilter($ob... | php | {
"resource": ""
} |
q244992 | Driver.isUniqueValue | validation | public function isUniqueValue($strField, $varNew, $intId = null)
{
$attribute = $this->getMetaModel()->getAttribute($strField);
if ($attribute) {
$matchingIds = $this
->prepareFilter(
$this->getEmptyConfig()->setFilter(
array(
... | php | {
"resource": ""
} |
q244993 | Driver.resetFallback | validation | public function resetFallback($strField)
{
// @codingStandardsIgnoreStart
@trigger_error(__CLASS__ . '::' . __METHOD__ . ' is deprecated - handle resetting manually', E_USER_DEPRECATED);
// @codingStandardsIgnoreEnd
$metaModel = $this->getMetaModel();
$attribute = $metaModel... | php | {
"resource": ""
} |
q244994 | Driver.save | validation | public function save(ModelInterface $objItem, $timestamp = null)
{
if (null === $timestamp) {
// @codingStandardsIgnoreStart
@\trigger_error(
'Not passing a timestamp has been deprecated and will cause an error in MetaModels 3',
E_USER_DEPRECATED
... | php | {
"resource": ""
} |
q244995 | Driver.saveEach | validation | public function saveEach(CollectionInterface $objItems, $timestamp = 0)
{
if (null === $timestamp) {
// @codingStandardsIgnoreStart
@\trigger_error(
'Not passing a timestamp has been deprecated and will cause an error in MetaModels 3',
E_USER_DEPRECATE... | php | {
"resource": ""
} |
q244996 | Driver.sameModels | validation | public function sameModels($objModel1, $objModel2)
{
if (!($objModel1 instanceof Model && $objModel2 instanceof Model)) {
throw new \InvalidArgumentException('Passed models are not valid.');
}
$objNative1 = $objModel1->getItem();
$objNative2 = $objModel2->getItem();
... | php | {
"resource": ""
} |
q244997 | Driver.createVariant | validation | public function createVariant(ConfigInterface $objConfig)
{
$objItem = $this->getMetaModel()->findById($objConfig->getId())->varCopy();
if (!$objItem) {
return null;
}
$model = new Model($objItem);
$model->setMeta($model::IS_CHANGED, true);
return $mode... | php | {
"resource": ""
} |
q244998 | NameAndDescriptionListener.decodeValue | validation | public function decodeValue(DecodePropertyValueForWidgetEvent $event)
{
if (!($this->wantToHandle($event) && \in_array($event->getProperty(), ['name', 'description']))) {
return;
}
$metaModel = $this->getMetaModelByModelPid($event->getModel());
$values = Helper::decod... | php | {
"resource": ""
} |
q244999 | NameAndDescriptionListener.encodeValue | validation | public function encodeValue(EncodePropertyValueFromWidgetEvent $event)
{
if (!($this->wantToHandle($event) && \in_array($event->getProperty(), ['name', 'description']))) {
return;
}
$metaModel = $this->getMetaModelByModelPid($event->getModel());
$values = Helper::encod... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.