/** * @param Field $field * * @return array */ public function resolve(Field $field) { $defaults = ['required' => false, 'label' => $field->getLabel()]; $definition = $this->registry->findDefinitionFor($field->getDocument()); $attributes = $definition->getAttributes($field); return array_merge($defaults, $this->trim($attributes)); }
/** * @param ColumnInfoInterface $columnInfo * @param ODMMongoDBClassMetadataInfo $metadata * * @return array */ private function getODMTransformerInfo(ColumnInfoInterface $columnInfo, ODMMongoDBClassMetadataInfo $metadata) { $fieldName = $columnInfo->getPropertyPath(); if (in_array($metadata->getTypeOfField($fieldName), ['entity', 'entities'])) { $mapping = $metadata->getFieldMapping($fieldName); $target = $mapping['targetEntity']; if (!$this->doctrine->getRepository($target) instanceof ReferableEntityRepositoryInterface) { return; } return array($this->transformer, array('class' => $target, 'multiple' => 'entities' === $metadata->getTypeOfField($fieldName))); } if (in_array($metadata->getTypeOfField($fieldName), ['one', 'many'])) { $mapping = $metadata->getFieldMapping($fieldName); $target = $mapping['targetDocument']; // TODO Remove this hack switch ($target) { case 'Pim\\Bundle\\CatalogBundle\\Model\\ProductPrice': case 'Pim\\Bundle\\CatalogBundle\\Model\\Metric': return; } if (!$this->doctrine->getRepository($target) instanceof ReferableEntityRepositoryInterface) { return; } return array($this->transformer, array('class' => $mapping['targetDocument'], 'multiple' => 'many' === $metadata->getTypeOfField($fieldName))); } }
public function __construct($max_attempts, RegistryInterface $registry) { $this->db_login_obj = $registry->get("db_login"); $this->number_of_attempts = 0; $this->output_data = array(); $this->input_data = array(); $this->max_attempts = $max_attempts["max_attempts"]; }
/** * @param ClassMetadataInfo $metadata */ private function convertToDocumentIfNeeded(ClassMetadataInfo $metadata) { foreach ($this->resourceRegistry->getAll() as $alias => $resourceMetadata) { if ($metadata->getName() !== $resourceMetadata->getClass('model')) { continue; } if ($resourceMetadata->hasClass('repository')) { $metadata->setCustomRepositoryClass($resourceMetadata->getClass('repository')); } $metadata->isMappedSuperclass = false; } }
/** * @param string $template * @param string $content */ public function process($template, $content) { $overrides = $this->registry->get($template); if (0 === count($overrides)) { return; } $template = $this->crawlerFactory->createCrawler($content); foreach ($overrides as $override) { $this->apply($override, $template); } return $template->toHtml(); }
/** * Clear the Unit of Work of the manager(s) from the clearable entities * between batch writes * * @param bool $full True to clear all entities */ public function clear($full = false) { $nonClearableEntities = $full ? [] : $this->nonClearableEntities; foreach ($this->managerRegistry->getManagers() as $objectManager) { $identityMap = $objectManager->getUnitOfWork()->getIdentityMap(); $managedClasses = array_keys($identityMap); $nonClearableClasses = array_intersect($managedClasses, $nonClearableEntities); if (empty($nonClearableClasses)) { $objectManager->clear(); } else { $clearableClasses = array_diff($managedClasses, $nonClearableEntities); foreach ($clearableClasses as $clearableClass) { $objectManager->clear($clearableClass); } } } $this->doctrineCache->clear($nonClearableEntities); }
/** * @Then /^final source of template "([^"]*)" should be:$/ */ public function finalSourceOfTemplateShouldBe($template, PyStringNode $expected) { if (null !== $this->override) { $this->registry->add($this->override); } $actual = preg_replace("/\r|\n/", "", $this->twig->getLoader()->getSource($template)); $expected = preg_replace("/\r|\n/", "", $expected->getRaw()); $actual = preg_replace('~>\\s+<~m', '><', $actual); $expected = preg_replace('~>\\s+<~m', '><', $expected); if ($expected !== $actual) { $actual = explode(PHP_EOL, (string) $actual); $expected = explode(PHP_EOL, (string) $expected); $diff = new \Diff($expected, $actual, array()); $renderer = new \Diff_Renderer_Text_Unified(); $text = $diff->render($renderer); throw new \Exception(sprintf("Output does not match expected template. \n\n %s", $text)); } }
public function __construct(RegistryInterface $registry) { $this->db_video_obj = $registry->get(Definitions::DB_VIDEOS); $this->search_result = []; }
public function __construct(RegistryInterface $registry) { $this->db_questions_obj = $registry->get('db_questions'); $this->input_data = []; }
public function __construct(RegistryInterface $registry) { $this->db_confirm_obj = $registry->get("db_signup_confirm"); }
public function __construct(RegistryInterface $registry) { $this->db_signup_obj = $registry->get("db_signup"); $this->input_data = []; }
/** * Uninstall a package * * Remove files * @param \PEAR2\Pyrus\Package $package */ function uninstall(PackageFileInterface $package, RegistryInterface $reg) { if (!empty($this->_options['register-only'])) { // pretty much nothing happens if we are only registering the install return; } try { $config = new Config\Snapshot($package->date . ' ' . $package->time); } catch (\Exception $e) { throw new Installer\Exception('Cannot retrieve files, config ' . 'snapshot could not be processed', $e); } $configpaths = array(); foreach (Installer\Role::getValidRoles($package->getPackageType()) as $role) { // set up a list of file role => configuration variable // for storing in the registry $roleobj = Installer\Role::factory($package->getPackageType(), $role); $configpaths[$role] = $config->{$roleobj->getLocationConfig()}; } $ret = array(); foreach ($reg->info($package->name, $package->channel, 'installedfiles') as $file) { $transact = AtomicFileTransaction::getTransactionObject($file['configpath']); $transact->removePath($file['relativepath']); } }
/** * {@inheritDoc} */ public function getStorages() { return $this->staticRegistry->getStorages(); }
/** * {@inheritDoc} */ public function getStorages() { return array_replace($this->fallbackRegistry->getStorages(), $this->registry->getStorages()); }