/** * Constructor * * @param ObjectManager $objectManager The ObjectManager to use * @param bool $byValue If set to true, hydrator will always use entity's public API */ public function __construct(ObjectManager $objectManager, $byValue = true) { parent::__construct(); $this->objectManager = $objectManager; $this->byValue = (bool) $byValue; }
public function __construct($queryMap = null, $namespaces = null, $xpath = null) { parent::__construct(); $this->setQueryMap($queryMap); $this->setNamespaces($namespaces); $this->setXPath($xpath); }
/** * Define if extract values will use camel case or name with underscore * @param bool|array $underscoreSeparatedKeys */ public function __construct($underscoreSeparatedKeys = true) { parent::__construct(); $this->setUnderscoreSeparatedKeys($underscoreSeparatedKeys); $this->filterComposite->addFilter("is", new IsFilter()); $this->filterComposite->addFilter("has", new HasFilter()); $this->filterComposite->addFilter("get", new GetFilter()); $this->filterComposite->addFilter("parameter", new NumberOfParameterFilter(), FilterComposite::CONDITION_AND); }
/** * @param ObjectManager $objectManager * @param HydratorInterface $hydrator */ public function __construct(ObjectManager $objectManager, HydratorInterface $hydrator = null) { $this->objectManager = $objectManager; if (null === $hydrator) { $hydrator = new ClassMethodsHydrator(false); } $this->setHydrator($hydrator); parent::__construct(); }
/** * Define if extract values will use camel case or name with underscore * @param bool|array $underscoreSeparatedKeys */ public function __construct($underscoreSeparatedKeys = true) { parent::__construct(); $this->setUnderscoreSeparatedKeys($underscoreSeparatedKeys); $this->callableMethodFilter = new OptionalParametersFilter(); $this->filterComposite->addFilter('is', new IsFilter()); $this->filterComposite->addFilter('has', new HasFilter()); $this->filterComposite->addFilter('get', new GetFilter()); $this->filterComposite->addFilter('parameter', new OptionalParametersFilter(), FilterComposite::CONDITION_AND); }
public function __construct() { parent::__construct(); $this->init(); }
/** * Define if extract values will use camel case or name with underscore * @param boolean $underscoreSeparatedKeys */ public function __construct($underscoreSeparatedKeys = true) { parent::__construct(); $this->underscoreSeparatedKeys = $underscoreSeparatedKeys; }
/** * Creates a social profiles collection hydrator. * * @param array $profileClassMap */ public function __construct(array $profileClassMap = array()) { parent::__construct(); $this->profileClassMap = array_merge($this->profileClassMap, $profileClassMap); }
public function __construct() { parent::__construct(); $this->init(); $this->excludeMethods = array(); }
/** * Add filters to the Hydrator based on a predefined configuration format, if specified. * * @param AbstractHydrator $hydrator * @param ServiceLocatorInterface $serviceManager * @param $config * @param $objectManager */ protected function configureHydratorFilters($hydrator, $serviceManager, $config, $objectManager) { if (!$hydrator instanceof FilterEnabledInterface || !isset($config['filters']) || !is_array($config['filters'])) { return; } foreach ($config['filters'] as $name => $filterConfig) { $conditionMap = array('and' => FilterComposite::CONDITION_AND, 'or' => FilterComposite::CONDITION_OR); $condition = isset($filterConfig['condition']) ? $conditionMap[$filterConfig['condition']] : FilterComposite::CONDITION_OR; $filterService = $filterConfig['filter']; if (!$serviceManager->has($filterService)) { throw new ServiceNotCreatedException(sprintf('Invalid filter %s for field %s: service does not exist', $filterService, $name)); } $filterService = $serviceManager->get($filterService); if (!$filterService instanceof FilterInterface) { throw new InvalidCallbackException(sprintf('Filter service %s must implement FilterInterface'), get_class($filterService)); } if ($filterService instanceof ObjectManagerAwareInterface) { $filterService->setObjectManager($objectManager); } $hydrator->addFilter($name, $filterService, $condition); } }
/** * {@inheritDoc} * @throws InvalidArgumentException If a strategy added to a collection does not extend AbstractCollectionStrategy */ public function addStrategy($name, StrategyInterface $strategy) { if ($this->metadata->hasAssociation($name)) { if (!$strategy instanceof Strategy\AbstractCollectionStrategy) { throw new InvalidArgumentException(sprintf('Strategies used for collections valued associations must inherit from ' . 'Strategy\\AbstractCollectionStrategy, %s given', get_class($strategy))); } $strategy->setCollectionName($name)->setClassMetadata($this->metadata); } return parent::addStrategy($name, $strategy); }
/** * {@inheritDoc} */ public function removeNamingStrategy() { $this->resetCaches(); return parent::removeNamingStrategy(); }
/** * Constructor * * @param Mandango $objectManager The ObjectManager to use * @param string $modelClass The FQCN of the hydrated/extracted object */ public function __construct(Mandango $mandango, $modelClass) { parent::__construct(); $this->mandango = $mandango; $this->metadata = $mandango->getMetadata($modelClass); }