1
0
mirror of synced 2024-12-16 16:16:04 +03:00
doctrine2/lib/api/doctrine/common/collections/arraycollection.html
2010-04-14 17:13:14 +02:00

567 lines
22 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta name="generator" content="PHPDoctor 2RC4 (http://phpdoctor.sourceforge.net/)">
<meta name="when" content="Wed, 14 Apr 2010 15:12:03 +0000">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css">
<link rel="start" href="../../../overview-summary.html">
<title>ArrayCollection (Doctrine)</title>
</head>
<body id="definition" onload="parent.document.title=document.title;">
<div class="header">
<h1>Doctrine</h1>
<ul>
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="../../../doctrine/common/collections/package-summary.html">Namespace</a></li>
<li class="active">Class</li>
<li><a href="../../../doctrine/common/collections/package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
</ul>
</div>
<div class="small_links">
<a href="../../../index.html" target="_top">Frames</a>
<a href="../../../doctrine/common/collections/arraycollection.html" target="_top">No frames</a>
</div>
<div class="small_links">
Summary: <a href="#summary_field">Field</a> | <a href="#summary_method">Method</a> | <a href="#summary_constr">Constr</a>
Detail: <a href="#detail_field">Field</a> | <a href="#detail_method">Method</a> | <a href="#summary_constr">Constr</a>
</div>
<hr>
<div class="qualifiedName">Doctrine\Common\Collections\ArrayCollection</div>
<div class="location">/Doctrine/Common/Collections/ArrayCollection.php at line 38</div>
<h1>Class ArrayCollection</h1>
<pre class="tree"><strong>ArrayCollection</strong><br /></pre>
<hr>
<p class="signature">public class <strong>ArrayCollection</strong></p>
<div class="comment" id="overview_description"><p>An ArrayCollection is a Collection implementation that uses a regular PHP array
internally.</p></div>
<dl>
<dt>License:</dt>
<dd>http://www.opensource.org/licenses/lgpl-license.php LGPL</dd>
<dt>See Also:</dt>
<dd><code>www.doctrine-project.org</code></dd>
<dt>Since:</dt>
<dd>2.0</dd>
<dt>Version:</dt>
<dd>$Revision: 3938 $</dd>
<dt>Author:</dt>
<dd>Guilherme Blanco <guilhermeblanco@hotmail.com></dd>
<dd>Jonathan Wage <jonwage@gmail.com></dd>
<dd>Roman Borschel <roman@code-factory.org></dd>
</dl>
<hr>
<table id="summary_constr">
<tr><th colspan="2">Constructor Summary</th></tr>
<tr>
<td class="description"><p class="name"><a href="#ArrayCollection()">ArrayCollection</a>(array elements)</p><p class="description">Initializes a new ArrayCollection.</p></td>
</tr>
</table>
<table id="summary_method">
<tr><th colspan="2">Method Summary</th></tr>
<tr>
<td class="type"> boolean</td>
<td class="description"><p class="name"><a href="#add()">add</a>(mixed value)</p><p class="description">Adds an element to the collection.</p></td>
</tr>
<tr>
<td class="type"> void</td>
<td class="description"><p class="name"><a href="#clear()">clear</a>()</p><p class="description">Clears the collection.</p></td>
</tr>
<tr>
<td class="type"> boolean</td>
<td class="description"><p class="name"><a href="#contains()">contains</a>(mixed element)</p><p class="description">Checks whether the given element is contained in the collection.
</p></td>
</tr>
<tr>
<td class="type"> boolean</td>
<td class="description"><p class="name"><a href="#containsKey()">containsKey</a>(mixed key)</p><p class="description">Checks whether the collection contains a specific key/index.</p></td>
</tr>
<tr>
<td class="type"> integer</td>
<td class="description"><p class="name"><a href="#count()">count</a>()</p><p class="description">Returns the number of elements in the collection.
</p></td>
</tr>
<tr>
<td class="type"> mixed</td>
<td class="description"><p class="name"><a href="#current()">current</a>()</p><p class="description">Gets the element of the collection at the current internal iterator position.</p></td>
</tr>
<tr>
<td class="type"> boolean</td>
<td class="description"><p class="name"><a href="#exists()">exists</a>(Closure p)</p><p class="description">Tests for the existance of an element that satisfies the given predicate.</p></td>
</tr>
<tr>
<td class="type"> <a href="../../../doctrine/common/collections/collection.html">Collection</a></td>
<td class="description"><p class="name"><a href="#filter()">filter</a>(Closure p)</p><p class="description">Returns all the elements of this collection that satisfy the predicate p.
</p></td>
</tr>
<tr>
<td class="type"> mixed</td>
<td class="description"><p class="name"><a href="#first()">first</a>()</p><p class="description">Sets the internal iterator to the first element in the collection and
returns this element.</p></td>
</tr>
<tr>
<td class="type"> boolean</td>
<td class="description"><p class="name"><a href="#forAll()">forAll</a>(Closure p)</p><p class="description">Applies the given predicate p to all elements of this collection,
returning true, if the predicate yields true for all elements.</p></td>
</tr>
<tr>
<td class="type"> mixed</td>
<td class="description"><p class="name"><a href="#get()">get</a>(mixed key)</p><p class="description">Gets the element with the given key/index.</p></td>
</tr>
<tr>
<td class="type"> ArrayIterator</td>
<td class="description"><p class="name"><a href="#getIterator()">getIterator</a>()</p><p class="description">Gets an iterator for iterating over the elements in the collection.</p></td>
</tr>
<tr>
<td class="type"> array</td>
<td class="description"><p class="name"><a href="#getKeys()">getKeys</a>()</p><p class="description">Gets all keys/indexes of the collection elements.</p></td>
</tr>
<tr>
<td class="type"> array</td>
<td class="description"><p class="name"><a href="#getValues()">getValues</a>()</p><p class="description">Gets all elements.</p></td>
</tr>
<tr>
<td class="type"> mixed</td>
<td class="description"><p class="name"><a href="#indexOf()">indexOf</a>(mixed element)</p><p class="description">Searches for a given element and, if found, returns the corresponding key/index
of that element. </p></td>
</tr>
<tr>
<td class="type"> boolean</td>
<td class="description"><p class="name"><a href="#isEmpty()">isEmpty</a>()</p><p class="description">Checks whether the collection is empty.
</p></td>
</tr>
<tr>
<td class="type"> mixed</td>
<td class="description"><p class="name"><a href="#key()">key</a>()</p><p class="description">Gets the current key/index at the current internal iterator position.</p></td>
</tr>
<tr>
<td class="type"> mixed</td>
<td class="description"><p class="name"><a href="#last()">last</a>()</p><p class="description">Sets the internal iterator to the last element in the collection and
returns this element.</p></td>
</tr>
<tr>
<td class="type"> <a href="../../../doctrine/common/collections/collection.html">Collection</a></td>
<td class="description"><p class="name"><a href="#map()">map</a>(Closure func)</p><p class="description">Applies the given function to each element in the collection and returns
a new collection with the elements returned by the function.</p></td>
</tr>
<tr>
<td class="type"> mixed</td>
<td class="description"><p class="name"><a href="#next()">next</a>()</p><p class="description">Moves the internal iterator position to the next element.</p></td>
</tr>
<tr>
<td class="type"> void</td>
<td class="description"><p class="name"><a href="#offsetExists()">offsetExists</a>(mixed offset)</p><p class="description">ArrayAccess implementation of offsetExists()</p></td>
</tr>
<tr>
<td class="type"> void</td>
<td class="description"><p class="name"><a href="#offsetGet()">offsetGet</a>(mixed offset)</p><p class="description">ArrayAccess implementation of offsetGet()</p></td>
</tr>
<tr>
<td class="type"> void</td>
<td class="description"><p class="name"><a href="#offsetSet()">offsetSet</a>(mixed offset, mixed value)</p><p class="description">ArrayAccess implementation of offsetGet()</p></td>
</tr>
<tr>
<td class="type"> void</td>
<td class="description"><p class="name"><a href="#offsetUnset()">offsetUnset</a>(mixed offset)</p><p class="description">ArrayAccess implementation of offsetUnset()</p></td>
</tr>
<tr>
<td class="type"> array</td>
<td class="description"><p class="name"><a href="#partition()">partition</a>(Closure p)</p><p class="description">Partitions this collection in two collections according to a predicate.
</p></td>
</tr>
<tr>
<td class="type"> mixed</td>
<td class="description"><p class="name"><a href="#remove()">remove</a>(mixed key)</p><p class="description">Removes an element with a specific key/index from the collection.</p></td>
</tr>
<tr>
<td class="type"> boolean</td>
<td class="description"><p class="name"><a href="#removeElement()">removeElement</a>(mixed element)</p><p class="description">Removes the specified element from the collection, if it is found.</p></td>
</tr>
<tr>
<td class="type"> void</td>
<td class="description"><p class="name"><a href="#set()">set</a>(mixed key, mixed value)</p><p class="description">Adds/sets an element in the collection at the index / with the specified key.
</p></td>
</tr>
<tr>
<td class="type"> array</td>
<td class="description"><p class="name"><a href="#toArray()">toArray</a>()</p><p class="description">Gets the PHP array representation of this collection.</p></td>
</tr>
</table>
<h2 id="detail_constr">Constructor Detail</h2>
<div class="location">/Doctrine/Common/Collections/ArrayCollection.php at line 53</div>
<h3 id="ArrayCollection()">ArrayCollection</h3>
<code class="signature">public <strong>ArrayCollection</strong>(array elements)</code>
<div class="details">
<p>Initializes a new ArrayCollection.</p></div>
<hr>
<h2 id="detail_method">Method Detail</h2>
<div class="location">/Doctrine/Common/Collections/ArrayCollection.php at line 321</div>
<h3 id="add()">add</h3>
<code class="signature">public boolean <strong>add</strong>(mixed value)</code>
<div class="details">
<p>Adds an element to the collection.</p><dl>
<dt>Returns:</dt>
<dd>Always TRUE.</dd>
</dl>
</div>
<hr>
<div class="location">/Doctrine/Common/Collections/ArrayCollection.php at line 426</div>
<h3 id="clear()">clear</h3>
<code class="signature">public void <strong>clear</strong>()</code>
<div class="details">
<p>Clears the collection.</p></div>
<hr>
<div class="location">/Doctrine/Common/Collections/ArrayCollection.php at line 223</div>
<h3 id="contains()">contains</h3>
<code class="signature">public boolean <strong>contains</strong>(mixed element)</code>
<div class="details">
<p>Checks whether the given element is contained in the collection.
Only element values are compared, not keys. 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.</p><dl>
<dt>Returns:</dt>
<dd>TRUE if the given element is contained in the collection, FALSE otherwise.</dd>
</dl>
</div>
<hr>
<div class="location">/Doctrine/Common/Collections/ArrayCollection.php at line 208</div>
<h3 id="containsKey()">containsKey</h3>
<code class="signature">public boolean <strong>containsKey</strong>(mixed key)</code>
<div class="details">
<p>Checks whether the collection contains a specific key/index.</p><dl>
<dt>Parameters:</dt>
<dd>key - The key to check for.</dd>
<dt>Returns:</dt>
<dd>TRUE if the given key/index exists, FALSE otherwise.</dd>
</dl>
</div>
<hr>
<div class="location">/Doctrine/Common/Collections/ArrayCollection.php at line 296</div>
<h3 id="count()">count</h3>
<code class="signature">public integer <strong>count</strong>()</code>
<div class="details">
<p>Returns the number of elements in the collection.</p><p>Implementation of the Countable interface.</p><dl>
<dt>Returns:</dt>
<dd>The number of elements in the collection.</dd>
</dl>
</div>
<hr>
<div class="location">/Doctrine/Common/Collections/ArrayCollection.php at line 115</div>
<h3 id="current()">current</h3>
<code class="signature">public mixed <strong>current</strong>()</code>
<div class="details">
<p>Gets the element of the collection at the current internal iterator position.</p></div>
<hr>
<div class="location">/Doctrine/Common/Collections/ArrayCollection.php at line 234</div>
<h3 id="exists()">exists</h3>
<code class="signature">public boolean <strong>exists</strong>(Closure p)</code>
<div class="details">
<p>Tests for the existance of an element that satisfies the given predicate.</p><dl>
<dt>Parameters:</dt>
<dd>p - The predicate.</dd>
<dt>Returns:</dt>
<dd>TRUE if the predicate is TRUE for at least one element, FALSE otherwise.</dd>
</dl>
</div>
<hr>
<div class="location">/Doctrine/Common/Collections/ArrayCollection.php at line 368</div>
<h3 id="filter()">filter</h3>
<code class="signature">public <a href="../../../doctrine/common/collections/collection.html">Collection</a> <strong>filter</strong>(Closure p)</code>
<div class="details">
<p>Returns all the elements of this collection that satisfy the predicate p.
The order of the elements is preserved.</p><dl>
<dt>Parameters:</dt>
<dd>p - The predicate used for filtering.</dd>
<dt>Returns:</dt>
<dd>A collection with the results of the filter operation.</dd>
</dl>
</div>
<hr>
<div class="location">/Doctrine/Common/Collections/ArrayCollection.php at line 74</div>
<h3 id="first()">first</h3>
<code class="signature">public mixed <strong>first</strong>()</code>
<div class="details">
<p>Sets the internal iterator to the first element in the collection and
returns this element.</p></div>
<hr>
<div class="location">/Doctrine/Common/Collections/ArrayCollection.php at line 380</div>
<h3 id="forAll()">forAll</h3>
<code class="signature">public boolean <strong>forAll</strong>(Closure p)</code>
<div class="details">
<p>Applies the given predicate p to all elements of this collection,
returning true, if the predicate yields true for all elements.</p><dl>
<dt>Parameters:</dt>
<dd>p - The predicate.</dd>
<dt>Returns:</dt>
<dd>TRUE, if the predicate yields TRUE for all elements, FALSE otherwise.</dd>
</dl>
</div>
<hr>
<div class="location">/Doctrine/Common/Collections/ArrayCollection.php at line 261</div>
<h3 id="get()">get</h3>
<code class="signature">public mixed <strong>get</strong>(mixed key)</code>
<div class="details">
<p>Gets the element with the given key/index.</p><dl>
<dt>Parameters:</dt>
<dd>key - The key.</dd>
<dt>Returns:</dt>
<dd>The element or NULL, if no element exists for the given key.</dd>
</dl>
</div>
<hr>
<div class="location">/Doctrine/Common/Collections/ArrayCollection.php at line 344</div>
<h3 id="getIterator()">getIterator</h3>
<code class="signature">public ArrayIterator <strong>getIterator</strong>()</code>
<div class="details">
<p>Gets an iterator for iterating over the elements in the collection.</p></div>
<hr>
<div class="location">/Doctrine/Common/Collections/ArrayCollection.php at line 274</div>
<h3 id="getKeys()">getKeys</h3>
<code class="signature">public array <strong>getKeys</strong>()</code>
<div class="details">
<p>Gets all keys/indexes of the collection elements.</p></div>
<hr>
<div class="location">/Doctrine/Common/Collections/ArrayCollection.php at line 284</div>
<h3 id="getValues()">getValues</h3>
<code class="signature">public array <strong>getValues</strong>()</code>
<div class="details">
<p>Gets all elements.</p></div>
<hr>
<div class="location">/Doctrine/Common/Collections/ArrayCollection.php at line 250</div>
<h3 id="indexOf()">indexOf</h3>
<code class="signature">public mixed <strong>indexOf</strong>(mixed element)</code>
<div class="details">
<p>Searches for a given element and, if found, returns the corresponding key/index
of that 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.</p><dl>
<dt>Parameters:</dt>
<dd>element - The element to search for.</dd>
<dt>Returns:</dt>
<dd>The key/index of the element or FALSE if the element was not found.</dd>
</dl>
</div>
<hr>
<div class="location">/Doctrine/Common/Collections/ArrayCollection.php at line 334</div>
<h3 id="isEmpty()">isEmpty</h3>
<code class="signature">public boolean <strong>isEmpty</strong>()</code>
<div class="details">
<p>Checks whether the collection is empty.</p><p>Note: This is preferrable over count() == 0.</p><dl>
<dt>Returns:</dt>
<dd>TRUE if the collection is empty, FALSE otherwise.</dd>
</dl>
</div>
<hr>
<div class="location">/Doctrine/Common/Collections/ArrayCollection.php at line 95</div>
<h3 id="key()">key</h3>
<code class="signature">public mixed <strong>key</strong>()</code>
<div class="details">
<p>Gets the current key/index at the current internal iterator position.</p></div>
<hr>
<div class="location">/Doctrine/Common/Collections/ArrayCollection.php at line 85</div>
<h3 id="last()">last</h3>
<code class="signature">public mixed <strong>last</strong>()</code>
<div class="details">
<p>Sets the internal iterator to the last element in the collection and
returns this element.</p></div>
<hr>
<div class="location">/Doctrine/Common/Collections/ArrayCollection.php at line 356</div>
<h3 id="map()">map</h3>
<code class="signature">public <a href="../../../doctrine/common/collections/collection.html">Collection</a> <strong>map</strong>(Closure func)</code>
<div class="details">
<p>Applies the given function to each element in the collection and returns
a new collection with the elements returned by the function.</p></div>
<hr>
<div class="location">/Doctrine/Common/Collections/ArrayCollection.php at line 105</div>
<h3 id="next()">next</h3>
<code class="signature">public mixed <strong>next</strong>()</code>
<div class="details">
<p>Moves the internal iterator position to the next element.</p></div>
<hr>
<div class="location">/Doctrine/Common/Collections/ArrayCollection.php at line 163</div>
<h3 id="offsetExists()">offsetExists</h3>
<code class="signature">public void <strong>offsetExists</strong>(mixed offset)</code>
<div class="details">
<p>ArrayAccess implementation of offsetExists()</p><dl>
<dt>See Also:</dt>
<dd>containsKey()</dd>
</dl>
</div>
<hr>
<div class="location">/Doctrine/Common/Collections/ArrayCollection.php at line 173</div>
<h3 id="offsetGet()">offsetGet</h3>
<code class="signature">public void <strong>offsetGet</strong>(mixed offset)</code>
<div class="details">
<p>ArrayAccess implementation of offsetGet()</p><dl>
<dt>See Also:</dt>
<dd>get()</dd>
</dl>
</div>
<hr>
<div class="location">/Doctrine/Common/Collections/ArrayCollection.php at line 184</div>
<h3 id="offsetSet()">offsetSet</h3>
<code class="signature">public void <strong>offsetSet</strong>(mixed offset, mixed value)</code>
<div class="details">
<p>ArrayAccess implementation of offsetGet()</p><dl>
<dt>See Also:</dt>
<dd>add()</dd>
<dd>set()</dd>
</dl>
</div>
<hr>
<div class="location">/Doctrine/Common/Collections/ArrayCollection.php at line 197</div>
<h3 id="offsetUnset()">offsetUnset</h3>
<code class="signature">public void <strong>offsetUnset</strong>(mixed offset)</code>
<div class="details">
<p>ArrayAccess implementation of offsetUnset()</p><dl>
<dt>See Also:</dt>
<dd>remove()</dd>
</dl>
</div>
<hr>
<div class="location">/Doctrine/Common/Collections/ArrayCollection.php at line 400</div>
<h3 id="partition()">partition</h3>
<code class="signature">public array <strong>partition</strong>(Closure p)</code>
<div class="details">
<p>Partitions this collection in two collections according to a predicate.
Keys are preserved in the resulting collections.</p><dl>
<dt>Parameters:</dt>
<dd>p - The predicate on which to partition.</dd>
<dt>Returns:</dt>
<dd>An array with two elements. The first element contains the collection of elements where the predicate returned TRUE, the second element contains the collection of elements where the predicate returned FALSE.</dd>
</dl>
</div>
<hr>
<div class="location">/Doctrine/Common/Collections/ArrayCollection.php at line 126</div>
<h3 id="remove()">remove</h3>
<code class="signature">public mixed <strong>remove</strong>(mixed key)</code>
<div class="details">
<p>Removes an element with a specific key/index from the collection.</p></div>
<hr>
<div class="location">/Doctrine/Common/Collections/ArrayCollection.php at line 144</div>
<h3 id="removeElement()">removeElement</h3>
<code class="signature">public boolean <strong>removeElement</strong>(mixed element)</code>
<div class="details">
<p>Removes the specified element from the collection, if it is found.</p></div>
<hr>
<div class="location">/Doctrine/Common/Collections/ArrayCollection.php at line 310</div>
<h3 id="set()">set</h3>
<code class="signature">public void <strong>set</strong>(mixed key, mixed value)</code>
<div class="details">
<p>Adds/sets an element in the collection at the index / with the specified key.</p><p>When the collection is a Map this is like put(key,value)/add(key,value).
When the collection is a List this is like add(position,value).</p></div>
<hr>
<div class="location">/Doctrine/Common/Collections/ArrayCollection.php at line 63</div>
<h3 id="toArray()">toArray</h3>
<code class="signature">public array <strong>toArray</strong>()</code>
<div class="details">
<p>Gets the PHP array representation of this collection.</p><dl>
<dt>Returns:</dt>
<dd>The PHP array representation of this collection.</dd>
</dl>
</div>
<hr>
<div class="header">
<h1>Doctrine</h1>
<ul>
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="../../../doctrine/common/collections/package-summary.html">Namespace</a></li>
<li class="active">Class</li>
<li><a href="../../../doctrine/common/collections/package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
</ul>
</div>
<div class="small_links">
<a href="../../../index.html" target="_top">Frames</a>
<a href="../../../doctrine/common/collections/arraycollection.html" target="_top">No frames</a>
</div>
<div class="small_links">
Summary: <a href="#summary_field">Field</a> | <a href="#summary_method">Method</a> | <a href="#summary_constr">Constr</a>
Detail: <a href="#detail_field">Field</a> | <a href="#detail_method">Method</a> | <a href="#summary_constr">Constr</a>
</div>
<hr>
<p id="footer">This document was generated by <a href="http://peej.github.com/phpdoctor/">PHPDoctor: The PHP Documentation Creator</a></p>
</body>
</html>