1235. Class

1235.1. Zend\Navigation\AbstractContainer

Zend_Navigation_Container

AbstractContainer class for ZendNavigationPage classes.

1235.1.1. Methods

1235.1.1.1. sort

sort()

Sorts the page index according to page order

Return type:void

1235.1.1.2. notifyOrderUpdated

notifyOrderUpdated()

Notifies container that the order of pages are updated

Return type:void

1235.1.1.3. addPage

addPage()

Adds a page to the container

This method will inject the container as the given page’s parent by calling {@link PageAbstractPage::setParent()}.

Parameters:PageAbstractPage|array|Traversable – page to add
Return type:AbstractContainer fluent interface, returns self
Throws :ExceptionInvalidArgumentException if page is invalid

1235.1.1.4. addPages

addPages()

Adds several pages at once

Parameters:array|Traversable|AbstractContainer – pages to add
Return type:AbstractContainer fluent interface, returns self
Throws :ExceptionInvalidArgumentException if $pages is not array, Traversable or AbstractContainer

1235.1.1.5. setPages

setPages()

Sets pages this container should have, removing existing pages

Parameters:array – pages to set
Return type:AbstractContainer fluent interface, returns self

1235.1.1.6. getPages

getPages()

Returns pages in the container

Return type:array array of PageAbstractPage instances

1235.1.1.7. removePage

removePage()

Removes the given page from the container

Parameters:PageAbstractPage|int – page to remove, either a page instance or a specific page order
Return type:bool whether the removal was successful

1235.1.1.8. removePages

removePages()

Removes all pages in container

Return type:AbstractContainer fluent interface, returns self

1235.1.1.9. hasPage

hasPage()

Checks if the container has the given page

Parameters:
  • PageAbstractPage – page to look for
  • bool – [optional] whether to search recursively. Default is false.
Return type:

bool whether page is in container

1235.1.1.10. hasPages

hasPages()

Returns true if container contains any pages

Return type:bool whether container has any pages

1235.1.1.11. findOneBy

findOneBy()

Returns a child page matching $property == $value, or null if not found

Parameters:
  • string – name of property to match against
  • mixed – value to match property against
Return type:

PageAbstractPage|null matching page or null

1235.1.1.12. findAllBy

findAllBy()

Returns all child pages matching $property == $value, or an empty array if no pages are found

Parameters:
  • string – name of property to match against
  • mixed – value to match property against
Return type:

array array containing only PageAbstractPage instances

1235.1.1.13. findBy

findBy()

Returns page(s) matching $property == $value

Parameters:
  • string – name of property to match against
  • mixed – value to match property against
  • bool – [optional] whether an array of all matching pages should be returned, or only the first. If true, an array will be returned, even if not matching pages are found. If false, null will be returned if no matching page is found. Default is false.
Return type:

PageAbstractPage|null matching page or null

1235.1.1.14. __call

__call()

Magic overload: Proxy calls to finder methods

Examples of finder calls: <code> // METHOD // SAME AS $nav->findByLabel(‘foo’); // $nav->findOneBy(‘label’, ‘foo’); $nav->findOneByLabel(‘foo’); // $nav->findOneBy(‘label’, ‘foo’); $nav->findAllByClass(‘foo’); // $nav->findAllBy(‘class’, ‘foo’); </code>

Parameters:
  • string – method name
  • array – method arguments
Throws ExceptionBadMethodCallException:
 

if method does not exist

1235.1.1.15. toArray

toArray()

Returns an array representation of all pages in container

Return type:array

1235.1.1.16. current

current()

Returns current page

Implements RecursiveIterator interface.

Return type:PageAbstractPage current page or null
Throws :ExceptionOutOfBoundsException if the index is invalid

1235.1.1.17. key

key()

Returns hash code of current page

Implements RecursiveIterator interface.

Return type:string hash code of current page

1235.1.1.19. rewind

rewind()

Sets index pointer to first page in the container

Implements RecursiveIterator interface.

Return type:void

1235.1.1.20. valid

valid()

Checks if container index is valid

Implements RecursiveIterator interface.

Return type:bool

1235.1.1.21. hasChildren

hasChildren()

Proxy to hasPages()

Implements RecursiveIterator interface.

Return type:bool whether container has any pages

1235.1.1.22. getChildren

getChildren()

Returns the child container.

Implements RecursiveIterator interface.

Return type:PageAbstractPage|null

1235.1.1.23. count

count()

Returns number of pages in container

Implements Countable interface.

Return type:int number of pages in the container