Last active
July 14, 2016 07:54
-
-
Save smichaelsen/7afac33fe90f4f14003e1e11246c4fdd to your computer and use it in GitHub Desktop.
Nested foreach over ObjectStorage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
array (size=4) | |
0 => string 'outer' (length=5) | |
1 => string 'inner' (length=5) | |
2 => string 'inner' (length=5) | |
3 => string 'inner' (length=5) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use TYPO3\CMS\Extbase\Domain\Model\FrontendUser; | |
use TYPO3\CMS\Extbase\Persistence\ObjectStorage; | |
$testObjectStorage = new ObjectStorage(); | |
$testObjectStorage->attach(new FrontendUser()); | |
$testObjectStorage->attach(new FrontendUser()); | |
$testObjectStorage->attach(new FrontendUser()); | |
$executions = []; | |
foreach ($testObjectStorage as $feUser) { | |
$executions[] = 'outer'; | |
foreach ($testObjectStorage as $feUser) { | |
$executions[] = 'inner'; | |
} | |
} | |
var_dump($executions); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment