本文整理汇总了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);
}
示例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());
}
示例3: removeReport
public function removeReport(ReportModule $reportModule)
{
$index = $this->modules->indexOf($reportModule);
if ($index !== null) {
$this->modules->remove($index);
}
return $this;
}
示例4: indexOf
public function indexOf($element)
{
$index = parent::indexOf($element);
if (is_numeric($index)) {
$index += 1;
}
return $index;
}
示例5: removeCourse
public function removeCourse(CourseModule $courseModule)
{
$index = $this->modules->indexOf($courseModule);
if ($index !== null) {
$this->modules->remove($index);
}
return $this;
}
示例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'));
}
示例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;
}
示例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');
}
示例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();
}
示例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);
}
示例11: indexOf
/** {@inheritDoc} */
public function indexOf($element)
{
$this->initialize();
return $this->collection->indexOf($element);
}
示例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);
}
示例13: indexOf
/**
* @param Column $column
*
* @return bool|int|string
*/
public function indexOf($column)
{
$this->columnTypeExpected($column);
return parent::indexOf($column);
}
示例14: indexOf
function indexOf($element)
{
return $this->fields->indexOf($element);
}