• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Util\ClassUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Doctrine\Common\Util\ClassUtils的典型用法代码示例。如果您正苦于以下问题:PHP ClassUtils类的具体用法?PHP ClassUtils怎么用?PHP ClassUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ClassUtils类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: transform

 /**
  * {@inheritdoc}
  */
 public function transform($value)
 {
     if (!$value) {
         return '';
     }
     if (is_array($value)) {
         $result = [];
         $user = $this->securityFacade->getToken()->getUser();
         foreach ($value as $target) {
             if (ClassUtils::getClass($user) === ClassUtils::getClass($target) && $user->getId() === $target->getId()) {
                 continue;
             }
             if ($fields = $this->mapper->getEntityMapParameter(ClassUtils::getClass($target), 'title_fields')) {
                 $text = [];
                 foreach ($fields as $field) {
                     $text[] = $this->mapper->getFieldValue($target, $field);
                 }
             } else {
                 $text = [(string) $target];
             }
             $text = implode(' ', $text);
             if ($label = $this->getClassLabel(ClassUtils::getClass($target))) {
                 $text .= ' (' . $label . ')';
             }
             $result[] = json_encode(['text' => $text, 'id' => json_encode(['entityClass' => ClassUtils::getClass($target), 'entityId' => $target->getId()])]);
         }
         $value = implode(';', $result);
     }
     return $value;
 }
开发者ID:northdakota,项目名称:platform,代码行数:33,代码来源:ContextsToViewTransformer.php


示例2: postSetData

 /**
  * @param FormEvent $event
  */
 public function postSetData(FormEvent $event)
 {
     $form = $event->getForm();
     if ($form->getParent()) {
         return;
     }
     if (!$form->has($this->fieldName)) {
         return;
     }
     $isEntityExists = false;
     $entity = $event->getData();
     if ($entity) {
         if (!is_object($entity)) {
             return;
         }
         $entityClass = ClassUtils::getClass($entity);
         $entityManager = $this->managerRegistry->getManagerForClass($entityClass);
         if (!$entityManager) {
             return;
         }
         $entityIdentifier = $entityManager->getClassMetadata($entityClass)->getIdentifierValues($entity);
         $isEntityExists = !empty($entityIdentifier);
     }
     // if entity exists and assign is not granted - replace field with disabled text field,
     // otherwise - set default owner value
     if ($isEntityExists) {
         $this->replaceOwnerField($form);
     } else {
         $this->setPredefinedOwner($form);
     }
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:34,代码来源:OwnerFormSubscriber.php


示例3: getActivityContext

 /**
  * Returns the context for the given activity class and id
  *
  * @param string $class The FQCN of the activity entity
  * @param        $id
  *
  * @return array
  */
 public function getActivityContext($class, $id)
 {
     $currentUser = $this->securityTokenStorage->getToken()->getUser();
     $userClass = ClassUtils::getClass($currentUser);
     $entity = $this->doctrineHelper->getEntity($class, $id);
     $result = [];
     if (!$entity || !$entity instanceof ActivityInterface) {
         return $result;
     }
     $targets = $entity->getActivityTargetEntities();
     $entityProvider = $this->configManager->getProvider('entity');
     foreach ($targets as $target) {
         $targetClass = ClassUtils::getClass($target);
         $targetId = $target->getId();
         if ($userClass === $targetClass && $currentUser->getId() === $targetId) {
             continue;
         }
         $item = [];
         $config = $entityProvider->getConfig($targetClass);
         $safeClassName = $this->entityClassNameHelper->getUrlSafeClassName($targetClass);
         $item = $this->prepareItemTitle($item, $targetClass, $target, $targetId);
         $item['activityClassAlias'] = $this->entityAliasResolver->getPluralAlias($class);
         $item['entityId'] = $id;
         $item['targetId'] = $targetId;
         $item['targetClassName'] = $safeClassName;
         $item['icon'] = $config->get('icon');
         $item['link'] = $this->getContextLink($targetClass, $targetId);
         $item = $this->dispatchContextTitle($item, $targetClass);
         $result[] = $item;
     }
     return $result;
 }
开发者ID:woei66,项目名称:platform,代码行数:40,代码来源:ActivityContextApiEntityManager.php


示例4: handleOnFlush

 /**
  * Handle onFlush event
  *
  * @param OnFlushEventArgs $event
  */
 public function handleOnFlush(OnFlushEventArgs $event)
 {
     $em = $event->getEntityManager();
     $uow = $em->getUnitOfWork();
     $newEntities = $uow->getScheduledEntityInsertions();
     foreach ($newEntities as $entity) {
         if ($entity instanceof Call) {
             $hasChanges = $this->activityManager->addActivityTarget($entity, $entity->getOwner());
             // recompute change set if needed
             if ($hasChanges) {
                 $uow->computeChangeSet($em->getClassMetadata(ClassUtils::getClass($entity)), $entity);
             }
         }
     }
     $changedEntities = $uow->getScheduledEntityUpdates();
     foreach ($changedEntities as $entity) {
         if ($entity instanceof Call) {
             $hasChanges = false;
             $changeSet = $uow->getEntityChangeSet($entity);
             foreach ($changeSet as $field => $values) {
                 if ($field === 'owner') {
                     list($oldValue, $newValue) = $values;
                     if ($oldValue !== $newValue) {
                         $hasChanges |= $this->activityManager->replaceActivityTarget($entity, $oldValue, $newValue);
                     }
                     break;
                 }
             }
             // recompute change set if needed
             if ($hasChanges) {
                 $uow->computeChangeSet($em->getClassMetadata(ClassUtils::getClass($entity)), $entity);
             }
         }
     }
 }
开发者ID:antrampa,项目名称:crm,代码行数:40,代码来源:CallActivityManager.php


示例5: isEntity

 /**
  * Check object status is enity
  *
  * @param object|string $entity
  * @return bool
  */
 protected function isEntity($entity)
 {
     if (is_object($entity)) {
         $entity = ClassUtils::getClass($entity);
     }
     return !$this->entityManager->getMetadataFactory()->isTransient($entity);
 }
开发者ID:pecinaon,项目名称:doctrine-mapper,代码行数:13,代码来源:BaseMapper.php


示例6: addOwnerField

 /**
  * Add owner field to forms
  *
  * @param BeforeFormRenderEvent $event
  */
 public function addOwnerField(BeforeFormRenderEvent $event)
 {
     $environment = $event->getTwigEnvironment();
     $data = $event->getFormData();
     $form = $event->getForm();
     $label = false;
     $entityProvider = $this->configManager->getProvider('entity');
     if (is_object($form->vars['value'])) {
         $className = ClassUtils::getClass($form->vars['value']);
         if (class_exists($className) && $entityProvider->hasConfig($className, 'owner')) {
             $config = $entityProvider->getConfig($className, 'owner');
             $label = $config->get('label');
         }
     }
     $ownerField = $environment->render("OroOrganizationBundle::owner.html.twig", array('form' => $form, 'label' => $label));
     /**
      * Setting owner field as first field in first data block
      */
     if (!empty($data['dataBlocks'])) {
         if (isset($data['dataBlocks'][0]['subblocks'])) {
             if (!isset($data['dataBlocks'][0]['subblocks'][0])) {
                 $data['dataBlocks'][0]['subblocks'][0] = ['data' => []];
             }
             array_unshift($data['dataBlocks'][0]['subblocks'][0]['data'], $ownerField);
         }
     }
     $event->setFormData($data);
 }
开发者ID:Maksold,项目名称:platform,代码行数:33,代码来源:FormListener.php


示例7: onFlush

 /**
  * @param OnFlushEventArgs $args
  */
 public function onFlush(OnFlushEventArgs $args)
 {
     $this->initializeFromEventArgs($args);
     $entities = array_merge($this->uow->getScheduledEntityInsertions(), $this->uow->getScheduledEntityDeletions(), $this->uow->getScheduledEntityUpdates());
     /** @var Opportunity[] $entities */
     $entities = array_filter($entities, function ($entity) {
         return 'OroCRM\\Bundle\\SalesBundle\\Entity\\Opportunity' === ClassUtils::getClass($entity);
     });
     foreach ($entities as $entity) {
         if (!$entity->getId() && $this->isValuable($entity)) {
             // handle creation, just add to prev lifetime value and recalculate change set
             $b2bCustomer = $entity->getCustomer();
             $b2bCustomer->setLifetime($b2bCustomer->getLifetime() + $entity->getCloseRevenue());
             $this->scheduleUpdate($b2bCustomer);
             $this->uow->computeChangeSet($this->em->getClassMetadata(ClassUtils::getClass($b2bCustomer)), $b2bCustomer);
         } elseif ($this->uow->isScheduledForDelete($entity) && $this->isValuable($entity)) {
             $this->scheduleUpdate($entity->getCustomer());
         } elseif ($this->uow->isScheduledForUpdate($entity)) {
             // handle update
             $changeSet = $this->uow->getEntityChangeSet($entity);
             if ($this->isChangeSetValuable($changeSet)) {
                 if (!empty($changeSet['customer']) && $changeSet['customer'][0] instanceof B2bCustomer && B2bCustomerRepository::VALUABLE_STATUS === $this->getOldStatus($entity, $changeSet)) {
                     // handle change of b2b customer
                     $this->scheduleUpdate($changeSet['customer'][0]);
                 }
                 if ($this->isValuable($entity, isset($changeSet['closeRevenue'])) || B2bCustomerRepository::VALUABLE_STATUS === $this->getOldStatus($entity, $changeSet) && $entity->getCustomer()) {
                     $this->scheduleUpdate($entity->getCustomer());
                 }
             }
         }
     }
 }
开发者ID:antrampa,项目名称:crm,代码行数:35,代码来源:B2bCustomerLifetimeListener.php


示例8: invalidateProcess

 /**
  * @param $entity
  */
 public function invalidateProcess($entity)
 {
     $handler = $this->getHandlerByClass(ClassUtils::getClass($entity));
     if ($handler) {
         $handler->invalidateProcess($entity);
     }
 }
开发者ID:Maksold,项目名称:platform,代码行数:10,代码来源:EntityApiHandlerProcessor.php


示例9: name

 /**
  * {@inheritdoc}
  */
 public function name($objectOrClass)
 {
     $class = is_object($objectOrClass) ? ClassUtils::getClass($objectOrClass) : $objectOrClass;
     if (!isset($this->names[$class])) {
         $nsParts = array_map(function ($nsPart) {
             return explode('_', StringsUtil::toUnderscore($nsPart));
         }, explode('\\', $class));
         $offset = array_search(['entity'], $nsParts);
         if ($offset) {
             $nsParts = array_slice($nsParts, $offset + 1);
         }
         $nsPartsCount = count($nsParts);
         for ($i = 0; $i < $nsPartsCount - 1; $i++) {
             if (array_intersect($nsParts[$i], $nsParts[$i + 1]) === $nsParts[$i]) {
                 unset($nsParts[$i]);
             }
         }
         $parts = [];
         foreach ($nsParts as $nsPart) {
             $parts = array_merge($parts, $nsPart);
         }
         $this->names[$class] = implode('_', $parts);
     }
     return $this->names[$class];
 }
开发者ID:darvinstudio,项目名称:darvin-utils,代码行数:28,代码来源:ObjectNamer.php


示例10: onFlush

 /**
  * Collect changes that were done
  * Generates tags and store in protected variable
  *
  * @param OnFlushEventArgs $event
  */
 public function onFlush(OnFlushEventArgs $event)
 {
     if (!$this->isApplicationInstalled) {
         return;
     }
     $em = $event->getEntityManager();
     $uow = $em->getUnitOfWork();
     $entities = array_merge($uow->getScheduledEntityDeletions(), $uow->getScheduledEntityInsertions(), $uow->getScheduledEntityUpdates());
     $collections = array_merge($uow->getScheduledCollectionUpdates(), $uow->getScheduledCollectionDeletions());
     foreach ($collections as $collection) {
         $owner = $collection->getOwner();
         if (!in_array($owner, $entities, true)) {
             $entities[] = $owner;
         }
     }
     $generator = $this->sender->getGenerator();
     foreach ($entities as $entity) {
         if (!in_array(ClassUtils::getClass($entity), $this->skipTrackingFor)) {
             // invalidate collection view pages only when entity has been added or removed
             $includeCollectionTag = $uow->isScheduledForInsert($entity) || $uow->isScheduledForDelete($entity);
             $this->collectedTags = array_merge($this->collectedTags, $generator->generate($entity, $includeCollectionTag));
         }
     }
     $this->collectedTags = array_unique($this->collectedTags);
 }
开发者ID:xamin123,项目名称:platform,代码行数:31,代码来源:DoctrineTagEventListener.php


示例11: isApplicable

 /**
  * Checks if the entity can have comments
  *
  * @param object|null $entity
  *
  * @return bool
  */
 public function isApplicable($entity)
 {
     if (!is_object($entity) || !$this->doctrineHelper->isManageableEntity($entity) || !$this->securityFacade->isGranted('oro_comment_view')) {
         return false;
     }
     return $this->commentAssociationHelper->isCommentAssociationEnabled(ClassUtils::getClass($entity));
 }
开发者ID:olegpopadko,项目名称:platform,代码行数:14,代码来源:CommentPlaceholderFilter.php


示例12: getSnapshotDeleteQueryBuilderByEntities

 /**
  * Returns DELETE query builder with conditions for deleting from snapshot table by entity
  *
  * @param array $entities
  * @throws \InvalidArgumentException
  * @return QueryBuilder|null
  */
 protected function getSnapshotDeleteQueryBuilderByEntities(array $entities)
 {
     if (empty($entities)) {
         throw new \InvalidArgumentException('List of entity can not be empty');
     }
     $deleteParams = array();
     $entityManager = $this->getEntityManager();
     $segmentQB = $entityManager->createQueryBuilder();
     $segmentQB->select('s.id, s.entity')->from('OroSegmentBundle:Segment', 's');
     foreach ($entities as $key => $entity) {
         if (is_array($entity) && array_key_exists('id', $entity)) {
             $entityId = $entity['id'];
             $className = ClassUtils::getClass($entity['entity']);
         } else {
             /** @var object $entity */
             $className = ClassUtils::getClass($entity);
             $metadata = $entityManager->getClassMetadata($className);
             $entityIds = $metadata->getIdentifierValues($entity);
             $entityId = reset($entityIds);
         }
         if (!$entityId) {
             continue;
         }
         if (!isset($deleteParams[$className])) {
             $segmentQB->orWhere('s.entity = :className' . $key)->setParameter('className' . $key, $className);
         }
         $deleteParams[$className]['entityIds'][] = (string) $entityId;
     }
     $segments = $segmentQB->getQuery()->getResult();
     foreach ($segments as $segment) {
         $deleteParams[$segment['entity']]['segmentIds'][] = (string) $segment['id'];
     }
     return $this->getDeleteQueryBuilderByParameters($deleteParams);
 }
开发者ID:xamin123,项目名称:platform,代码行数:41,代码来源:SegmentSnapshotRepository.php


示例13: buildCacheEntry

 /**
  * {@inheritdoc}
  */
 public function buildCacheEntry(ClassMetadata $metadata, EntityCacheKey $key, $entity)
 {
     $data = $this->uow->getOriginalEntityData($entity);
     $data = array_merge($data, $key->identifier);
     // why update has no identifier values ?
     foreach ($metadata->associationMappings as $name => $assoc) {
         if (!isset($data[$name])) {
             continue;
         }
         if (!isset($assoc['cache']) || !($assoc['type'] & ClassMetadata::TO_ONE)) {
             unset($data[$name]);
             continue;
         }
         if (!isset($assoc['id'])) {
             $targetClass = ClassUtils::getClass($data[$name]);
             $targetId = $this->uow->getEntityIdentifier($data[$name]);
             $data[$name] = new AssociationCacheEntry($targetClass, $targetId);
             continue;
         }
         // handle association identifier
         $targetId = is_object($data[$name]) && $this->uow->isInIdentityMap($data[$name]) ? $this->uow->getEntityIdentifier($data[$name]) : $data[$name];
         // @TODO - fix it !
         // handle UnitOfWork#createEntity hash generation
         if (!is_array($targetId)) {
             $data[reset($assoc['joinColumnFieldNames'])] = $targetId;
             $targetEntity = $this->em->getClassMetadata($assoc['targetEntity']);
             $targetId = array($targetEntity->identifier[0] => $targetId);
         }
         $data[$name] = new AssociationCacheEntry($assoc['targetEntity'], $targetId);
     }
     return new EntityCacheEntry($metadata->name, $data);
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:35,代码来源:DefaultEntityHydrator.php


示例14: supports

 /**
  * {@inheritdoc}
  */
 public function supports(PuliResource $resource)
 {
     if (false === $resource instanceof CmfResource) {
         return false;
     }
     return $this->metadataFactory->hasMetadataFor(ClassUtils::getRealClass($resource->getPayloadType()));
 }
开发者ID:symfony-cmf,项目名称:resource,代码行数:10,代码来源:PhpcrOdmEnhancer.php


示例15: save

 /**
  * {@inheritdoc}
  */
 public function save($group, array $options = [])
 {
     /* @var GroupInterface */
     if (!$group instanceof GroupInterface) {
         throw new \InvalidArgumentException(sprintf('Expects a "Pim\\Bundle\\CatalogBundle\\Model\\GroupInterface", "%s" provided.', ClassUtils::getClass($group)));
     }
     $this->eventDispatcher->dispatch(GroupEvents::PRE_SAVE, new GenericEvent($group));
     $options = $this->optionsResolver->resolveSaveOptions($options);
     $this->versionContext->addContextInfo(sprintf('Comes from variant group %s', $group->getCode()), $this->productClassName);
     if ($group->getType()->isVariant()) {
         $template = $group->getProductTemplate();
         if (null !== $template) {
             $this->templateMediaManager->handleProductTemplateMedia($template);
         }
     }
     $this->objectManager->persist($group);
     if (true === $options['flush']) {
         $this->objectManager->flush();
     }
     if (count($options['add_products']) > 0) {
         $this->addProducts($options['add_products']);
     }
     if (count($options['remove_products']) > 0) {
         $this->removeProducts($options['remove_products']);
     }
     if ($group->getType()->isVariant() && true === $options['copy_values_to_products']) {
         $this->copyVariantGroupValues($group);
     }
     $this->eventDispatcher->dispatch(GroupEvents::POST_SAVE, new GenericEvent($group));
 }
开发者ID:umpirsky,项目名称:pim-community-dev,代码行数:33,代码来源:GroupSaver.php


示例16: createPendingVersion

 /**
  * Create a pending version for a versionable entity
  *
  * @param object      $versionable
  * @param string      $author
  * @param array       $changeset
  * @param string|null $context
  *
  * @return Version
  */
 public function createPendingVersion($versionable, $author, array $changeset, $context = null)
 {
     $resourceName = ClassUtils::getClass($versionable);
     $version = new Version($resourceName, $versionable->getId(), $author, $context);
     $version->setChangeset($changeset);
     return $version;
 }
开发者ID:javiersantos,项目名称:pim-community-dev,代码行数:17,代码来源:VersionBuilder.php


示例17: setDefaults

 /**
  * {@inheritdoc}
  */
 public function setDefaults(MediaInterface $media, $parentPath = null)
 {
     $class = ClassUtils::getClass($media);
     // check and add name if possible
     if (!$media->getName()) {
         if ($media->getId()) {
             $media->setName(PathHelper::getNodeName($media->getId()));
         } else {
             throw new \RuntimeException(sprintf('Unable to set defaults, Media of type "%s" does not have a name or id.', $class));
         }
     }
     $rootPath = is_null($parentPath) ? $this->rootPath : $parentPath;
     $path = ($rootPath === '/' ? $rootPath : $rootPath . '/') . $media->getName();
     /** @var DocumentManager $dm */
     $dm = $this->getObjectManager();
     // TODO use PHPCR autoname once this is done: http://www.doctrine-project.org/jira/browse/PHPCR-103
     if ($dm->find($class, $path)) {
         // path already exists
         $media->setName($media->getName() . '_' . time() . '_' . rand());
     }
     if (!$media->getParent()) {
         $parent = $dm->find(null, PathHelper::getParentPath($path));
         $media->setParent($parent);
     }
 }
开发者ID:vespolina,项目名称:media,代码行数:28,代码来源:MediaManager.php


示例18: getEmailContext

 /**
  * Returns the context for the given email
  *
  * @param Email $email
  *
  * @return array
  */
 public function getEmailContext(Email $email)
 {
     $criteria = Criteria::create();
     $criteria->andWhere(Criteria::expr()->eq('id', $email->getId()));
     $qb = $this->activityManager->getActivityTargetsQueryBuilder($this->class, $criteria);
     if (null === $qb) {
         return [];
     }
     $result = $qb->getQuery()->getResult();
     if (empty($result)) {
         return $result;
     }
     $currentUser = $this->securityFacade->getLoggedUser();
     $currentUserClass = ClassUtils::getClass($currentUser);
     $currentUserId = $currentUser->getId();
     $result = array_values(array_filter($result, function ($item) use($currentUserClass, $currentUserId) {
         return !($item['entity'] === $currentUserClass && $item['id'] == $currentUserId);
     }));
     foreach ($result as &$item) {
         $route = $this->configManager->getEntityMetadata($item['entity'])->getRoute();
         $item['entityId'] = $email->getId();
         $item['targetId'] = $item['id'];
         $item['targetClassName'] = $this->entityClassNameHelper->getUrlSafeClassName($item['entity']);
         $item['icon'] = $this->configManager->getProvider('entity')->getConfig($item['entity'])->get('icon');
         $item['link'] = $route ? $this->router->generate($route, ['id' => $item['id']]) : null;
         unset($item['id'], $item['entity']);
     }
     return $result;
 }
开发者ID:nmallare,项目名称:platform,代码行数:36,代码来源:EmailApiEntityManager.php


示例19: moveAction

 /**
  * Move element
  *
  * @param string $position
  */
 public function moveAction($position)
 {
     $translator = $this->get('translator');
     if (!$this->admin->isGranted('EDIT')) {
         $this->addFlash('sonata_flash_error', $translator->trans('flash_error_no_rights_update_position'));
         return new RedirectResponse($this->admin->generateUrl('list', $this->admin->getFilterParameters()));
     }
     $object = $this->admin->getSubject();
     /** @var PositionHandler $positionService */
     $positionService = $this->get('pix_sortable_behavior.position');
     $entity = \Doctrine\Common\Util\ClassUtils::getClass($object);
     $lastPosition = $positionService->getLastPosition($entity);
     $position = $positionService->getPosition($object, $position, $lastPosition);
     $setter = sprintf('set%s', ucfirst($positionService->getPositionFieldByEntity($entity)));
     if (!method_exists($object, $setter)) {
         throw new \LogicException(sprintf('%s does not implement ->%s() to set the desired position.', $object, $setter));
     }
     $object->{$setter}($position);
     $this->admin->update($object);
     if ($this->isXmlHttpRequest()) {
         return $this->renderJson(array('result' => 'ok', 'objectId' => $this->admin->getNormalizedIdentifier($object)));
     }
     $this->addFlash('sonata_flash_success', $translator->trans('flash_success_position_updated'));
     return new RedirectResponse($this->admin->generateUrl('list', array('filter' => $this->admin->getFilterParameters())));
 }
开发者ID:siciarek,项目名称:pixSortableBehaviorBundle,代码行数:30,代码来源:SortableAdminController.php


示例20: newPagePartAction

 /**
  * @Route("/newPagePart", name="KunstmaanPagePartBundle_admin_newpagepart")
  * @Template("KunstmaanPagePartBundle:PagePartAdminTwigExtension:pagepart.html.twig")
  *
  * @param \Symfony\Component\HttpFoundation\Request $request
  *
  * @return array
  */
 public function newPagePartAction(Request $request)
 {
     $em = $this->getDoctrine()->getManager();
     $pageId = $request->get('pageid');
     $pageClassName = $request->get('pageclassname');
     $context = $request->get('context');
     $pagePartClass = $request->get('type');
     $page = $em->getRepository($pageClassName)->findOneById($pageId);
     $pagePartConfigurationReader = new PagePartConfigurationReader($this->container->get('kernel'));
     $pagePartAdminConfigurators = $pagePartConfigurationReader->getPagePartAdminConfigurators($page);
     $pagePartAdminConfigurator = null;
     foreach ($pagePartAdminConfigurators as $ppac) {
         if ($context == $ppac->getContext()) {
             $pagePartAdminConfigurator = $ppac;
         }
     }
     if (is_null($pagePartAdminConfigurator)) {
         throw new \RuntimeException(sprintf('No page part admin configurator found for context "%s".', $context));
     }
     $pagePartAdmin = new PagePartAdmin($pagePartAdminConfigurator, $em, $page, $context, $this->container);
     $pagePart = new $pagePartClass();
     $formFactory = $this->container->get('form.factory');
     $formBuilder = $formFactory->createBuilder(FormType::class);
     $pagePartAdmin->adaptForm($formBuilder);
     $id = 'newpp_' . time();
     $data = $formBuilder->getData();
     $data['pagepartadmin_' . $id] = $pagePart;
     $adminType = $pagePart->getDefaultAdminType();
     $adminTypeFqn = ClassUtils::getClass($adminType);
     $formBuilder->add('pagepartadmin_' . $id, $adminTypeFqn);
     $formBuilder->setData($data);
     $form = $formBuilder->getForm();
     $formview = $form->createView();
     return array('id' => $id, 'form' => $formview, 'pagepart' => $pagePart, 'pagepartadmin' => $pagePartAdmin, 'editmode' => true);
 }
开发者ID:VickyDeschrijver,项目名称:KunstmaanBundlesCMS,代码行数:43,代码来源:PagePartAdminController.php



注:本文中的Doctrine\Common\Util\ClassUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Util\Debug类代码示例发布时间:2022-05-23
下一篇:
PHP Mapping\ClassMetadata类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap