@param \Sonata\AdminBundle\Admin\AdminInterface $admin
@param array                                    $traits

@return bool
482920
public function isUseEntityTraits($admin, array $traits = [])
    {
        $traitsAdmin = [];

        $class = $admin->getClass();

        /* @noinspection PhpAssignmentInConditionInspection */
        do {
            /** @noinspection SlowArrayOperationsInLoopInspection */
            $traitsAdmin = array_merge(class_uses($class), $traitsAdmin);
        } while ($class = get_parent_class($class));

        foreach ($traitsAdmin as $trait => $same) {
            /** @noinspection SlowArrayOperationsInLoopInspection */
            $traitsAdmin = array_merge(class_uses($trait), $traitsAdmin);
        }

        $traitsAdmin = array_unique($traitsAdmin);

        foreach ($traits as $traitItem) {
            if (
            !\in_array($traitItem, $traitsAdmin)
            ) {
                return false;
            }
        }

        return true;
    }
962187
private function checkIfHaveSuperAdminRole($adminExists)
    {
        $hasRole = $adminExists->hasRole('super-admin');

        if( ! $hasRole ) {
            $this->comment("{$this->email} account doesn't have super-admin role!");

            if( $this->confirm('Do you want to add super-admin role? [y|N]') ) {

                DB::beginTransaction();

                try {
                    $adminExists->assignRoleBySlug('super-admin');
                } catch ( \Exception $e ) {
                    DB::rollback();

                    $this->error($e->getMessage());
                    exit;
                }

                $this->info('Super admin role has been added');

                DB::commit();
            }

            exit;
        }
    }
20704
public function canEdit($member = null)
    {
        if (!$member) {
            $member = Security::getCurrentUser();
        }

        $result = $this->extendedCan('canEdit', $member);
        if ($result !== null) {
            return $result;
        }

        if (Permission::checkMember($member, self::EDIT_ALL)) {
            return true;
        }

        // Check inherited permissions
        return static::getPermissionChecker()
            ->canEdit($this->ID, $member);
    }
218686
private function deepScanTraitsForProperty(array $traits) {
    	foreach ($traits as $trait) {
    		// If the trait has a property, it's a win!
    		$result = $this->deepScanTraitsForProperty($trait->getTraits(), $this->getName());
    		if ($result != null) {
    			return $result;
    		} else {
    			if ($trait->hasProperty($this->getName())) {
    				return $trait;
    			}
    		}
    	}
    	return null;
    }
199956
public function register()
    {
        $this->registerCommands();

        $this->app->singleton(AdminInterface::class, function () {
            return new Admin($this->nodes(), $this->navigation(), $this->app, $this->app->make(Route::class));
        });

        //$this->app->singleton(ModelRouterInterface::class, ModelRouter::class);
        $this->app->singleton(NodeModelConfigurationInterface::class, NodeModelConfiguration::class);
        $this->app->singleton(FormManagerInterface::class, FormTable::class);
        $this->app->singleton(TableInterface::class, DataTable::class);
        $this->app->singleton(ComponentManagerBuilderInterface::class, ComponentManagerBuilder::class);
        $this->app->singleton(TabsInterface::class, Tabs::class);
        $this->app->singleton(UploadFileInterface::class, UploadFile::class);
        $this->app->singleton(ChildRowsInterface::class, ChildRows::class);
        $this->app->singleton(ActionTableInterface::class, ActionTable::class);

    }
1373425
public function hasTrait($trait): bool {
		if (!$trait instanceof PhpTrait) {
			$trait = new PhpTrait($trait);
		}
		$name = $trait->getName();
		return in_array($name, $this->traits);
	}
1327880
final protected function getFormAdminType(FormMapper $formMapper, AdminInterface $admin, $formField, $field, $fieldOptions = [], $adminOptions = [])
    {
        $adminOptions = array_merge([
            'edit' => 'list',
            'translation_domain' => 'SonataClassificationBundle',
        ], $adminOptions);

        $fieldDescription = $admin->getModelManager()->getNewFieldDescriptionInstance($admin->getClass(), $field, $adminOptions);
        $fieldDescription->setAssociationAdmin($admin);
        $fieldDescription->setAdmin($formMapper->getAdmin());
        $fieldDescription->setAssociationMapping([
            'fieldName' => $field,
            'type' => ClassMetadataInfo::MANY_TO_ONE,
        ]);

        $fieldOptions = array_merge([
            'sonata_field_description' => $fieldDescription,
            'class' => $admin->getClass(),
            'model_manager' => $admin->getModelManager(),
            'required' => false,
        ], $fieldOptions);

        return $formMapper->create($formField, ModelTypeList::class, $fieldOptions);
    }
176571
private function generateTrait(PackageClass $package_class, array $traits)
    {
        $short_name = $package_class->getShortName();

        $this->writeIfVeryVerbose(
            '        - Generating trait of traits for <info>' . $package_class->getName() . '</info>'
        );

        $generated_namespace = $package_class->getGeneratedNamespaceName();

        $use_statements = array_filter(
            $traits,
            function (PackageClass $stmt) {
                return $stmt->isTrait();
            }
        );
        sort($use_statements);

        $data = $this->environment->render(
            'trait.php.twig',
            [
                'class_name' => $short_name,
                'namespace' => $generated_namespace,
                'use_statements' => $use_statements
            ]
        );

        $this->filesystem->dumpFile(
            $package_class->getGeneratedDirectory() . $short_name . 'Trait.php',
            $data
        );
    }
53523
protected function getManagedClass(Definition $admin, ContainerBuilder $container)
    {
        return $container->getParameterBag()->resolveValue($admin->getArgument(1));
    }
965689
public function getUrlsafeIdentifier($model, AdminInterface $admin = null)
    {
        if (null === $admin) {
            $admin = $this->pool->getAdminByClass(ClassUtils::getClass($model));
        }

        return $admin->getUrlsafeIdentifier($model);
    }
10126
public function isAdminActive(AdminInterface $admin, $adminCode = '')
    {
        $active = false;
        if ($adminCode == $admin->getCode()) {
            $active = true;
        }

        if (method_exists($admin, 'getSubNavLinks')) {
            foreach ($admin->getSubNavLinks() as $value) {
                if ($value instanceof AdminInterface) {
                    if ($value->getCode() == $adminCode) {
                        $active = true;
                    }
                }
            }
        }

        return $active;
    }
842318
public function add(TraitDefinition $traitToAdd)
    {
        foreach ($this->collection as $trait) {
            if ($trait === $traitToAdd) {
                throw new Exception(\sprintf('Trait already exists %s', \var_export($traitToAdd, true)));
            }
        }
        $this->collection[] = $traitToAdd;
    }
407846
private function retrieveFilterFieldDescription(
        AdminInterface $admin,
        string $field
    ): FieldDescriptionInterface {
        $admin->getFilterFieldDescriptions();

        $fieldDescription = $admin->getFilterFieldDescription($field);

        if (!$fieldDescription) {
            throw new \RuntimeException(sprintf('The field "%s" does not exist.', $field));
        }

        if (null === $fieldDescription->getTargetEntity()) {
            throw new \RuntimeException(sprintf('No associated entity with field "%s".', $field));
        }

        return $fieldDescription;
    }
1337194
public function isSmart(AdminInterface $admin, array $values = [])
    {
        // first : validate if elastica is asked in the configuration for this action
        $logicalControllerName = $admin->getRequest()->attributes->get('_controller');
        $currentAction = explode(':', $logicalControllerName);
        // remove Action from 'listAction'
        $currentAction = substr(end($currentAction), 0, -\strlen('Action'));
        // in case of batch|export action, no need to elasticsearch
        if (!\in_array($currentAction, $this->finderProvider->getActionsByAdmin($admin), true)) {
            return false;
        }

        // Get mapped field names
        $finderId = $this->finderProvider->getFinderIdByAdmin($admin);

        // Assume that finder id is composed like this 'fos_elastica.finder.<index name>.<type name>
        list($indexName, $typeName) = \array_slice(explode('.', $finderId), 2);
        $typeConfiguration = $this->configManager->getTypeConfiguration($indexName, $typeName);
        $mapping = $typeConfiguration->getMapping();
        $mappedFieldNames = array_keys($mapping['properties']);

        // Compare to the fields on wich the search apply
        $smart = true;

        foreach ($values as $key => $value) {
            if (!\is_array($value) || !isset($value['value'])) {
                // This is not a filter field
                continue;
            }

            if (!$value['value']) {
                // No value set on the filter field
                continue;
            }

            if (!\in_array($key, $mappedFieldNames, true)) {
                /*
                 * We are in the case where a field is used as filter
                 * without being mapped in elastic search.
                 * An ugly case would be to have a custom field used in the filter
                 * without mapping in the model, we need to control that
                 */
                $ret = $admin->getModelManager()->getParentMetadataForProperty(
                    $admin->getClass(),
                    $key,
                    $admin->getModelManager()
                );

                list($metadata, $propertyName, $parentAssociationMappings) = $ret;
                //Case if a filter is used in the filter but not linked to the ModelManager ("mapped" = false ) case
                if (!$metadata->hasField($key)) {
                    break;
                }
                // This filter field is not mapped in elasticsearch
                // so we cannot use elasticsearch
                $smart = false;

                break;
            }
        }

        return $smart;
    }
655372
public function &addTrait($interface = null, $implementation = null)
    {
        if (is_array($interface)) {
            foreach ($interface as $k => $v) {
                $this->addTrait($k, $v);
            }
        } else {
            if ($interface || $implementation) {
                if (empty($interface)) {
                    $interface = '--just-paste-trait--';
                }

                if (empty($this->traits[$interface])) {
                    $this->traits[$interface] = [];
                }

                if ($implementation && array_search($implementation, $this->traits[$interface]) === false) {
                    $this->traits[$interface][] = $implementation;
                }
            } else {
                throw new InvalidArgumentException('Interface or implementation are required');
            }
        }

        return $this;
    }
42084
public function admin( $options, $component ) {

		$post_types = (array) $this->post_types;
		$taxonomies = (array) $this->taxonomies;

		$method = 'migrate';
		// ajax_migrate
		pods_view( PODS_DIR . 'components/Migrate-CPTUI/ui/wizard.php', compact( array_keys( get_defined_vars() ) ) );
	}
772130
public function build(AdminInterface $admin, RouteCollection $collection)
    {
        $collection->add('list');
        $collection->add('create');
        $collection->add('batch', null, [], [], [], '', [], ['POST']);
        $collection->add('edit', $admin->getRouterIdParameter().'/edit', [], ['id' => '.+']);
        $collection->add('delete', $admin->getRouterIdParameter().'/delete', [], ['id' => '.+']);
        $collection->add('export');
        $collection->add('show', $admin->getRouterIdParameter().'/show', [], ['id' => '.+'], [], '', [], ['GET']);

        if ($admin->isAclEnabled()) {
            $collection->add('acl', $admin->getRouterIdParameter().'/acl', [], ['id' => '.+']);
        }

        // add children urls
        foreach ($admin->getChildren() as $children) {
            $collection->addCollection($children->getRoutes());
        }
    }