当前位置: 首页>>代码示例>>PHP>>正文


PHP ArrayCollection::indexOf方法代码示例

本文整理汇总了PHP中Doctrine\Common\Collections\ArrayCollection::indexOf方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayCollection::indexOf方法的具体用法?PHP ArrayCollection::indexOf怎么用?PHP ArrayCollection::indexOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine\Common\Collections\ArrayCollection的用法示例。


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

示例1: indexOf

 public function indexOf($element)
 {
     if (null === $this->entries) {
         $this->__load___();
     }
     return $this->entries->indexOf($element);
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:7,代码来源:AggregateEntryCollection.php

示例2: getIdentifier

 /**
  * @param AbstractAddress $address
  * @return string
  */
 public function getIdentifier(AbstractAddress $address)
 {
     $className = ClassUtils::getClass($address);
     if (!$this->map->contains($className)) {
         throw new \InvalidArgumentException(sprintf('Entity with "%s" not registered', $className));
     }
     return sprintf('%s%s%s', $this->map->indexOf($className), self::DELIMITER, $address->getId());
 }
开发者ID:adam-paterson,项目名称:orocommerce,代码行数:12,代码来源:OrderAddressManager.php

示例3: removeReport

 public function removeReport(ReportModule $reportModule)
 {
     $index = $this->modules->indexOf($reportModule);
     if ($index !== null) {
         $this->modules->remove($index);
     }
     return $this;
 }
开发者ID:Quiss,项目名称:RNMoT,代码行数:8,代码来源:Report.php

示例4: indexOf

 public function indexOf($element)
 {
     $index = parent::indexOf($element);
     if (is_numeric($index)) {
         $index += 1;
     }
     return $index;
 }
开发者ID:junjinZ,项目名称:wealthbot,代码行数:8,代码来源:ConsolidatedAccountsCollection.php

示例5: removeCourse

 public function removeCourse(CourseModule $courseModule)
 {
     $index = $this->modules->indexOf($courseModule);
     if ($index !== null) {
         $this->modules->remove($index);
     }
     return $this;
 }
开发者ID:Quiss,项目名称:Learning,代码行数:8,代码来源:Course.php

示例6: testIndexOf

 /**
  * Tests IdentityWrapper->indexOf()
  */
 public function testIndexOf()
 {
     foreach ($this->entries as $key => $entry) {
         $this->assertSame($key, $this->identityWrapper->indexOf($entry));
         $this->assertNotSame($key, $this->wrappedCollection->indexOf($entry));
     }
     $this->assertFalse($this->identityWrapper->indexOf('non-existent'));
 }
开发者ID:cross-solution,项目名称:yawik,代码行数:11,代码来源:IdentityWrapperTest.php

示例7: filterCollection

 /**
  * Filtering collection
  *
  * @param ArrayCollection|CrudEntityInterface[] $collection Collection
  * @param bool                                  $replace    replace
  *
  * @return CrudUnitOfWork
  */
 public function filterCollection(ArrayCollection $collection, $replace = true)
 {
     $unitOfWork = new CrudUnitOfWork();
     foreach ($collection as $entity) {
         if ($entity->getId()) {
             $crudEntity = $this->find(get_class($entity), $entity->getId());
         } else {
             $this->crudTransformer->initializeClassMetadata(get_class($entity));
             $conditions = $this->crudTransformer->getUniqueSearchConditions($entity);
             $crudEntity = $this->entityManager->getRepository(get_class($entity))->findOneBy($conditions);
         }
         if ($crudEntity instanceof CrudEntityInterface) {
             if ($replace) {
                 $key = $collection->indexOf($entity);
                 $collection->remove($key);
                 $collection->set($key, $crudEntity);
             }
             $unitOfWork->update($crudEntity);
         } else {
             $unitOfWork->insert($entity);
         }
     }
     return $unitOfWork;
 }
开发者ID:RuslanZavacky,项目名称:EcentriaRestBundle,代码行数:32,代码来源:CrudManager.php

示例8: testIndexOf

 public function testIndexOf()
 {
     $elements = array(1, 'A' => 'a', 2, 'null' => null, 3, 'A2' => 'a', 'zero' => 0);
     $collection = new ArrayCollection($elements);
     $this->assertSame(array_search(2, $elements, true), $collection->indexOf(2), 'Index of 2');
     $this->assertSame(array_search(null, $elements, true), $collection->indexOf(null), 'Index of null');
     $this->assertSame(array_search('non-existent', $elements, true), $collection->indexOf('non-existent'), 'Index of non existent');
 }
开发者ID:tccLaravel,项目名称:test4,代码行数:8,代码来源:ArrayCollectionTest.php

示例9: _addSubcontent

 /**
  * Adds a subcontent to the collection.
  *
  * @param \BackBee\CoreDomain\ClassContent\AbstractClassContent $value
  *
  * @return string the unique identifier of the add subcontent
  */
 protected function _addSubcontent(AbstractClassContent $value)
 {
     if (!$this->_subcontent->indexOf($value)) {
         $this->_subcontent->add($value);
     }
     $this->subcontentmap[$value->getUid()] = $this->_subcontent->indexOf($value);
     return $value->getUid();
 }
开发者ID:ReissClothing,项目名称:BackBee,代码行数:15,代码来源:AbstractClassContent.php

示例10: hasOxfordable

 /**
  * Test if there is a previous oxfordable word
  * available to the conjunction
  *
  * @param Conjunction $word
  * @return bool
  */
 private function hasOxfordable(Conjunction $word)
 {
     $index = $this->words->indexOf($word);
     return $this->words->offsetExists($index - 1);
 }
开发者ID:epfremmer,项目名称:PHP-Weekly-Issue28,代码行数:12,代码来源:Sentence.php

示例11: indexOf

 /** {@inheritDoc} */
 public function indexOf($element)
 {
     $this->initialize();
     return $this->collection->indexOf($element);
 }
开发者ID:nikophil,项目名称:cmf-tests,代码行数:6,代码来源:PersistentCollection.php

示例12: indexOf

 /**
  * Gets the index/key of a given element. The comparison of two elements is strict,
  * that means not only the value but also the type must match.
  * For objects this means reference equality.
  *
  * @param mixed $element The element to search for.
  *
  * @return int|string|bool The key/index of the element or FALSE if the element was not found.
  */
 public function indexOf($element)
 {
     return $this->collection->indexOf($element);
 }
开发者ID:Rybbow,项目名称:x-blog,代码行数:13,代码来源:ImmutableCollection.php

示例13: indexOf

 /**
  * @param Column $column
  *
  * @return bool|int|string
  */
 public function indexOf($column)
 {
     $this->columnTypeExpected($column);
     return parent::indexOf($column);
 }
开发者ID:ynloultratech,项目名称:framework,代码行数:10,代码来源:ColumnCollection.php

示例14: indexOf

 function indexOf($element)
 {
     return $this->fields->indexOf($element);
 }
开发者ID:tomaszhanc,项目名称:form-field-bundle,代码行数:4,代码来源:FieldCollection.php


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