本文整理汇总了PHP中Doctrine\Common\Collections\ArrayCollection::containsKey方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayCollection::containsKey方法的具体用法?PHP ArrayCollection::containsKey怎么用?PHP ArrayCollection::containsKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\Common\Collections\ArrayCollection
的用法示例。
在下文中一共展示了ArrayCollection::containsKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: find
/**
* @param string $name
*
* @return Blog|null
*/
public function find($name)
{
if ($this->blogs->containsKey($name)) {
return $this->blogs[$name];
}
return null;
}
示例2: getType
/**
* @param string $class
* @return ColumnTypeInterface
*/
public function getType(string $class)
{
if ($this->types->containsKey($class)) {
return $this->types[$class];
}
return null;
}
示例3: remove
/**
* @inheritdoc
*/
public function remove(User $user)
{
if (!$this->collection->containsKey((string) $user->getId())) {
throw new UserNotFoundException();
}
return $this->collection->removeElement($user);
}
示例4: addModel
public function addModel(BaseModel $model)
{
if (!$this->models->containsKey($model->name)) {
$model->bundle = $this;
$this->models->set($model->name, $model);
}
return $this;
}
示例5: addBundle
public function addBundle(BaseBundle $bundle)
{
if (!$this->bundles->containsKey($bundle->name)) {
$bundle->map = $this;
$this->bundles->set($bundle->name, $bundle);
}
return $this;
}
示例6: 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);
}
示例7: 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;
}
示例8: find
/**
* @param BlogId $id
*
* @return Blog|null
*/
public function find(BlogId $id)
{
$key = (string) $id;
if (!$this->storage->containsKey($key)) {
return null;
}
return $this->storage[$key];
}
示例9: addChannelType
/**
* Set registered types
*
* @param string $typeName
* @param IntegrationInterface $type
*
* @throws \LogicException
* @return $this
*/
public function addChannelType($typeName, IntegrationInterface $type)
{
if (!$this->integrationTypes->containsKey($typeName)) {
$this->integrationTypes->set($typeName, $type);
} else {
throw new LogicException(sprintf('Trying to redeclare integration type "%s".', $typeName));
}
return $this;
}
示例10: addActivity
/**
* Add activity
*
* @param Activity $activity
* @return Student
*/
public function addActivity(Activity $activity)
{
$key = $activity->getMachineName();
if ($this->activities->containsKey($key)) {
throw new \InvalidArgumentException('This Student already belongs to this Activity');
}
$this->activities->set($key, $activity);
return $this;
}
示例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: getPosition
/**
* Get a Key/Value position by Key, if it exists - returns false if the
* key does not exist
*
* @param mixed $key The key to search the index for
*
* @return integer|bool
*/
private function getPosition($key)
{
if ($this->index->containsKey($key)) {
return $this->index->get($key);
}
return false;
}
示例13: getPreviewImage
/**
* Get preview image
*
* @return Image
*/
public function getPreviewImage()
{
if ($this->images->containsKey($this->previewImageKey)) {
return $this->images->get($this->previewImageKey);
}
return $this->images->first();
}
示例14: 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;
}
示例15: startProviderEmulation
/**
* @param string $providerAlias
*/
public function startProviderEmulation($providerAlias)
{
if (!$this->providers->containsKey($providerAlias)) {
throw new \InvalidArgumentException(sprintf('Provider with "%s" alias not registered', $providerAlias));
}
$this->emulatedProvider = $this->providers->get($providerAlias);
}