本文整理汇总了PHP中Doctrine\Common\Collections\ArrayCollection::get方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayCollection::get方法的具体用法?PHP ArrayCollection::get怎么用?PHP ArrayCollection::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\Common\Collections\ArrayCollection
的用法示例。
在下文中一共展示了ArrayCollection::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getParameter
public function getParameter($parameter)
{
if (!$this->configs instanceof ArrayCollection) {
$this->generateConfigs($file = 'parameters.yml', null, false);
}
return $this->configs->get($parameter);
}
示例2: getParser
/**
* Gets a MarkdownParserInterface of the specified name/alias.
*
* @param string $name The parser name
*
* @return MarkdownParserInterface
*/
public function getParser($name)
{
if ($this->hasParser($name) === false) {
throw new \InvalidArgumentException(sprintf('The Markdown parser "%s" is not found.', $name));
}
return $this->parsers->get($name);
}
示例3: getPool
/**
* @param string $name
*
* @return CacheItemPoolInterface
* @throws RuntimeException
*/
public function getPool($name) : CacheItemPoolInterface
{
if (!$this->hasPool($name)) {
throw new RuntimeException(sprintf('Could not find cache pool with name %s.', $name));
}
return $this->pools->get($name);
}
示例4: enableContentProvider
/**
* Enable content provider by name.
*
* @param string $name
* @return ContentProviderManager
*/
public function enableContentProvider($name)
{
if ($this->hasContentProvider($name)) {
$this->contentProviders->get($name)->setEnabled(true);
}
return $this;
}
示例5: searchEntity
/**
* @param ImportRowProcess $item
* @return bool|mixed|null
*/
protected function searchEntity(ImportRowProcess $item)
{
$rowKey = $item->getRowKey();
if (!isset($this->entityKeyByRowKey[md5($rowKey)])) {
return false;
}
return $this->entityCollection->get($this->entityKeyByRowKey[md5($rowKey)]);
}
示例6: getDefault
/**
*
* @param string $key
* @param string $section
* @return \Doctrine\Common\Collections\ArrayCollection
*/
public function getDefault($key, $section = "default")
{
$data = null;
if ($this->defaults->containsKey($section . '.' . $key)) {
$data = $this->defaults->get($section . '.' . $key);
}
return $data;
}
示例7: searchEntity
/**
* @param ImportItemProcess $item
* @return bool|mixed|null
*/
protected function searchEntity(ImportItemProcess $item)
{
$outerId = $item->getItemValue();
if (!isset($this->entityKeyByOuterId[$outerId])) {
return false;
}
return $this->entityCollection->get($this->entityKeyByOuterId[$outerId]);
}
示例8: getAuditEntryFieldClass
/**
* @param AbstractUser $user
* @return string
*/
public function getAuditEntryFieldClass(AbstractUser $user)
{
$userClass = ClassUtils::getRealClass($user);
if (!$this->entryFieldMap->containsKey($userClass)) {
throw new \InvalidArgumentException(sprintf('Audit entry field not found for "%s"', $userClass));
}
return $this->entryFieldMap->get($userClass);
}
示例9: testGetNumbersForExistinUserWillReturn200ResponseWithNumbersList
public function testGetNumbersForExistinUserWillReturn200ResponseWithNumbersList()
{
$this->client->request('GET', '/users/1/numbers');
$response = $this->client->getResponse();
$this->assertJsonResponse($response, 200);
$numbers = new ArrayCollection($this->getContainer()->get('jms_serializer')->deserialize($response->getContent(), 'array<Arkon\\Bundle\\PhoneBookBundle\\Entity\\PhoneNumber>', 'json'));
$this->assertSame(694984427, $numbers->get(0)->getNumber());
$this->assertSame(724489496, $numbers->get(1)->getNumber());
}
示例10: build
/**
* @param ArrayCollection $data
* @return Artice
*/
public function build(ArrayCollection $data)
{
$article = new Article();
$article->setTitle($data->get('title'));
$article->setDescription($data->get('description'));
$article->setUrl($data->get('url'));
$article->setFeed($data->get('feed'));
$article->onPrePersist();
return $article;
}
示例11: getAuditEntryFieldClass
/**
* @param DiamanteUser|null $user
*
* @return string
*/
public function getAuditEntryFieldClass(DiamanteUser $user = null)
{
if ($user === null) {
return $this->entryFieldMap->first();
}
$userClass = ClassUtils::getRealClass($user);
if (!$this->entryFieldMap->containsKey($userClass)) {
throw new \InvalidArgumentException(sprintf('Audit entry field not found for "%s"', $userClass));
}
return $this->entryFieldMap->get($userClass);
}
示例12: find
/**
* @inheritdoc
*/
public function find(Uuid $uuid)
{
return $this->collection->get((string) $uuid);
/*
$criteria = Criteria::create()->where(Criteria::expr()->in('id', [$uuid]));
$result = $this->collection->matching($criteria);
if ($result->count()) {
return $result->first();
}
return null;*/
}
示例13: getOxfordItems
/**
* Return the last oxford comma eligible word
* in the sentence
*
* @return ArrayCollection|Word[]
*/
public function getOxfordItems()
{
$words = new ArrayCollection();
$conjunctions = $this->words->filter(function (Word $word) {
return $word instanceof Conjunction;
});
$conjunctions->map(function ($word) use($words) {
if ($this->hasOxfordable($word)) {
$index = $this->words->indexOf($word) - 1;
$words->add($this->words->get($index));
}
});
return $words;
}
示例14: generate
/**
* @param BundleInterface $bundle
* @param string $entity
* @param ClassMetadataInfo $metadata
* @param ArrayCollection $options
*
* @throws \RuntimeException
*/
public function generate(BundleInterface $bundle, $entity, ClassMetadataInfo $metadata, ArrayCollection $options = null)
{
$this->routePrefix = $options->get('route-prefix');
$this->routeNamePrefix = str_replace('/', '_', $options->get('route-prefix'));
$this->actions = ['getById', 'getAll', 'post', 'put', 'delete'];
if (count($metadata->identifier) > 1) {
throw new \RuntimeException('The REST Controller generator does not support entity classes with multiple primary keys.');
}
$this->entity = $entity;
$this->bundle = $bundle;
$this->metadata = $metadata;
$this->setFormat('yml');
$this->generateControllerClass($options->get('overwrite'), $options->get('document'), $options->get('resource'), $metadata);
}
示例15: getParameter
/**
* Get parameter.
*
* @param string $parameter
* @param mixed $default
*
* @return mixed
*/
public function getParameter($parameter, $default = null)
{
if (!$this->parameters instanceof ArrayCollection) {
return $default;
}
return $this->parameters->containsKey($parameter) ? $this->parameters->get($parameter) : $default;
}