How to use getIterator method of storage class

Best Atoum code snippet using storage.getIterator

ExportService.php

Source:ExportService.php Github

copy

Full Screen

...44 public function export($id, $model = false)45 {46 ini_set('max_execution_time', 0);47 ini_set('memory_limit', '4096M');48 $os = $this->getIterator()->where('ontology_type','ontology');49 foreach($os as $o){50 $data = json_decode($o->ontology_data);51 if($data->topDomain){52 $this->topDomainUuid = $o->ontology_uri;53 break;54 }55 }56 $onto = $this->readStorageService->getOntology(urldecode($id), 1);57 if ($onto) {58 //Dati ontologia59 $this->id = $onto->id->__get('id');60 $this->uri = ($onto->uri) ?: $id;61 //Entità62 $this->getEntities($id);63 //Proprietà64 $this->getProperties($id);65 $this->setSubProperties();66 //Relazioni67 $this->getRelations($id);68 $this->setInverseRelations();69 //Recupero informazioni eventuali da altre ontologie70 //come entità usate come superclassi e relative proprietà/relazioni71 $this->getOtherEntities();72 //Istanze di classi73 if(!$model){74 $this->getInstances($id);75 }76 77 $component = new \stdClass();78 $component->id = $this->id;79 $component->uri = $this->uri;80 if($this->properties){81 $datatypesMapping = (array)json_decode(\__Config::get('datatypes.mapping'));82 foreach($this->properties as $property){83 if($datatypesMapping[$property->value->id]){84 $property->type = $datatypesMapping[$property->value->id];85 }86 }87 }88 89 $extraNamespaces = null;90 $component->properties = $this->properties;91 $component->annotationProperties = $this->annotationProperties;92 $component->relations = $this->relations;93 $component->entities = $this->entities;94 $component->instances = $this->instances;95 $component->derivedFrom = ($this->derivedFrom);96 $component->derivedFromURIs = $this->derivedFromURIs;97 $component->derivedFromURICleans = $this->derivedFromURICleans;98 $skinClass = \__ObjectFactory::createObject('pinax.template.skin.PHPTAL', 'export.owl', [\__Config::get('pathToExportSkin')]);99 $skinClass->set('Component', $component);100 $output = @$skinClass->execute();101 if (!empty($extraNamespaces)) {102 $output = $this->getRdfHeader($output, $extraNamespaces);103 } else {104 $output = str_replace('attributeExtra="##"', '', $output);105 }106 return $output;107 }108 }109 private function getEntities($ontologyId)110 {111 $entities = $this->readStorageService->getOnlyEntitiesForOntology($ontologyId, '', 1, 0, true);112 foreach ($entities as $entity) {113 $this->entities[$entity->id] = $entity;114 }115 foreach($this->entities as $k => $entity)116 {117 if($entity->superclass && $entity->superclass->value)118 {119 $entity->superclass = $this->entities[$entity->superclass->value]->uri;120 $this->entities[$k] = $entity;121 }122 }123 }124 private function getOtherEntities()125 {126 //Verifico che le entità non siano sottoclassi di entità non trovate127 foreach ($this->entities as $entity) {128 if ($entity->superclass && !array_key_exists($entity->superclass->value, $this->entities)) {129 $superclass = $this->getIterator()->where('ontology_uri', $entity->superclass->value)->first();130 if ($superclass) {131 $this->entities[$entity->superclass->value] = json_decode($superclass->ontology_data);132 $entity->superclass = $this->entities[$entity->superclass->value]->uri;133 $propsRels = $this->getIterator()->where('ontology_parentUri', $entity->superclass->value);134 foreach ($propsRels as $pr) {135 if($pr->ontology_type == 'property'){136 $this->getPropertyData($pr);137 }138 else if($pr->ontology_type == 'relations'){139 $this->getRelationData($pr);140 }141 }142 }143 }144 }145 }146 private function getInstances($ontologyId)147 {148 $instances = $this->getIterator()149 ->where('ontology_type', 'terminology')150 ->where('ontology_group', $ontologyId);151 if ($instances) {152 foreach ($instances as $instance) {153 $data = json_decode($instance->ontology_data);154 $obj = new \stdClass();155 $obj->uri = $data->uri;156 $this->instances[$data->id] = $obj;157 }158 foreach ($instances as $instance) {159 $contents = $this->getTerminologyContents($instance);160 $owlContent = '';161 if ($contents->content) {162 foreach ($contents->content as $content) {163 if ($content->type == 'property') {164 if ($this->properties[$content->id]) {165 $label = end(explode('/',$content->uri));166 if($content->value->id == 'http://peb.icariccu.it/standard/fieldUrl'){167 $typeUrl = 'rdf:datatype="http://www.w3.org/2001/XMLSchema#anyURI"';168 }169 else{170 $typeUrl = null;171 }172 foreach($content->items as $item)173 {174 if($item->value && is_string($item->value))175 {176 $value = str_replace('&','&amp;',$item->value);177 if($typeUrl){178 $owlContent .= '<' .$label.' '.$typeUrl.'>' . $value . '</' . $label .'>';179 }180 else{181 $owlContent .= '<' .$label.'>' . $value . '</' . $label .'>';182 }183 } 184 }185 }186 }187 if ($content->type == 'relation') {188 if ($this->relations[$content->id]) {189 $label = end(explode('/',$content->uri));190 if($content->items[0]->value) {191 foreach($content->items[0]->value as $item)192 {193 if($item->value)194 {195 $owlContent .= '<' .$label.' rdf:resource="'.str_replace('"','_',$this->instances[$item->id]->uri).'"/>';196 } 197 }198 }199 }200 }201 }202 }203 $data = json_decode($instance->ontology_data);204 $data->content = $owlContent;205 $data->superclass = $this->entities[$data->superclass->value]->uri;206 $data->uri = str_replace('"','_',$data->uri);207 $this->instances[$data->id] = $data;208 }209 }210 }211 private function getProperties($ontologyId)212 {213 $properties = $this->getIterator()214 ->load('propertiesForOntology', ['ontologyId' => $ontologyId]);215 if(!$properties->count()){216 //Probabilmente è derivata in toto dalla Top217 $properties = $this->getIterator()218 ->load('propertiesForOntology', ['ontologyId' => $this->topDomainUuid]);219 }220 foreach ($properties as $p) {221 $this->getPropertyData($p);222 }223 }224 private function getPropertyData($p)225 {226 $data = json_decode($p->ontology_data);227 if ($data->type == 'property') {228 //Il dominio è il parent della property (se c'è)229 if ($p->ontology_parentUri) {230 $domain = new \stdClass();231 $domain->id = $this->entities[$p->ontology_parentUri]->uri;232 $domain->text = $this->entities[$p->ontology_parentUri]->uri;233 $data->domain = [$domain];234 }235 $this->properties[$data->id] = $data;236 }237 }238 private function getRelations($ontologyId)239 {240 $relations = $this->getIterator()241 ->load('propertiesForOntology', ['ontologyId' => $ontologyId]);242 if(!$relations->count()){243 //Probabilmente è derivata in toto dalla Top244 $relations = $this->getIterator()245 ->load('propertiesForOntology', ['ontologyId' => $this->topDomainUuid]);246 }247 foreach ($relations as $r) {248 $this->getRelationData($r);249 }250 }251 private function setInverseRelations()252 {253 if(!empty($this->relations)){254 foreach($this->relations as $relation){255 if($relation->reverseOf)256 {257 $relation->reverseOf = $this->relations[$relation->reverseOf->id]->uri;258 }259 }260 }261 }262 private function setSubProperties()263 {264 if(!empty($this->properties)){265 foreach($this->properties as $property){266 if($property->subpropertyOf)267 {268 $property->subpropertyOf = $this->properties[$property->subpropertyOf->id]->uri;269 }270 }271 }272 }273 private function getRelationData($r)274 {275 $data = json_decode($r->ontology_data);276 if ($data->type == 'relation') {277 if ($data->domain) {278 foreach ($data->domain as $d) {279 if($this->entities[$d->id]){280 $d->id = $this->entities[$d->id]->uri;281 }282 }283 }284 if ($data->codomain) {285 foreach ($data->codomain as $c) {286 if(!$c){287 unset($data->codomain);288 }289 if($c->id){290 if($this->entities[$c->id]){291 $c->id = $this->entities[$c->id]->uri;292 }293 }294 }295 }296 $this->relations[$data->id] = $data;297 }298 }299 private function getRdfHeader($output, $extraNamespaces)300 {301 $string = '';302 foreach ($extraNamespaces as $k => $v) {303 $string .= 'xmlns:' . $v . '="' . $k . '" ';304 }305 $string .= 'xml:base="' . $this->id . '" ';306 return str_replace('attributeExtra="##"', $string, $output);307 }308 public function getTerminologyContents($terminology)309 {310 $data = json_decode($terminology->ontology_data);311 if (!$data->uri) {312 $data->uri = $data->id;313 }314 if ($data->superclass) {315 if($this->entitiesData[$data->superclass->value]){316 $entity = $this->entitiesData[$data->superclass->value];317 }318 else{319 $entity = ($this->entitiesData[$data->superclass->value])?:$this->getIterator()->where('ontology_uri', $data->superclass->value)320 ->first();321 $this->entitiesData[$data->superclass->value] = $entity;322 }323 324 if ($entity) {325 if($this->entitiesPropertiesData[$entity->ontology_uri]){326 $properties = $this->entitiesPropertiesData[$entity->ontology_uri];327 }328 else{329 $properties = $this->getIterator()->load('propertiesForEntity', ['ontologyId' => $entity->ontology_parentUri, 'entitiesId' => [$entity->ontology_uri]]);330 $this->entitiesPropertiesData[$entity->ontology_uri] = $properties;331 }332 $propertiesForEntity = [];333 foreach ($properties as $p) {334 $propData = json_decode($p->ontology_data);335 $propertiesForEntity[$propData->id] = $propData;336 }337 $entityData = json_decode($entity->ontology_data);338 if ($entityData->copiedProperties) {339 foreach ($entityData->copiedProperties as $cp) {340 if (!array_key_exists($cp, $propertiesForEntity)) {341 if($this->propertiesData[$cp]){342 $propCopied = $this->propertiesData[$cp];343 }344 else{345 $propCopied = $this->getIterator()->where('ontology_uri', $cp)346 ->first();347 $this->propertiesData[$cp] = $propCopied;348 }349 if ($propCopied) {350 $propertiesForEntity[$cp] = json_decode($propCopied->ontology_data);351 }352 }353 }354 }355 }356 }357 if ($data->content) {358 foreach ($data->content as $c) {359 if ($c->type == 'relation') {360 if($this->propertiesData[$c->id]){361 $propInfo = $this->propertiesData[$c->id];362 }363 else{364 $propInfo = $this->getIterator()->where('ontology_uri', $c->id)->first();365 $this->propertiesData[$c->id] = $propInfo;366 }367 if ($propInfo) {368 $propInfoData = json_decode($propInfo->ontology_data);369 if ($propInfoData->reverseOf) {370 $c->reverseOf = $propInfoData->reverseOf;371 }372 }373 }374 if ($c->type == 'relation' && $c->reverseOf && $c->items[0]->value) {375 $relationInverseId = $c->reverseOf->id;376 $entityIds = $c->items[0]->value;377 foreach ($entityIds as $eId) {378 if($this->terminologiesData[$eId->id]){379 $termIt = $this->terminologiesData[$eId->id];380 }381 else{382 $termIt = $this->getIterator()->where('ontology_uri', $eId->id)383 ->first();384 $this->terminologiesData[$eId->id] = $termIt; 385 }386 387 if ($termIt) {388 $dataT = json_decode($termIt->ontology_data);389 foreach ($dataT->content as $termContent) {390 if ($termContent->id == $relationInverseId) {391 if (!$termContent->items[0]->value) {392 $c->items[0]->value = null;393 }394 }395 }396 }397 }398 }399 if (array_key_exists($c->id, $propertiesForEntity)) {400 unset($propertiesForEntity[$c->id]);401 }402 if (is_array($c->items[0]->value)) {403 foreach ($c->items[0]->value as $k => $v) {404 if($this->terminologiesData[$v->id]){405 $record = $this->terminologiesData[$v->id];406 }407 else{408 $record = $this->getIterator()->where('ontology_uri', $v->id)->first();409 $this->terminologiesData[$eId->id] = $record; 410 }411 if (!$record) {412 unset($c->items[0]->value[$k]);413 }414 }415 }416 }417 if (!empty($propertiesForEntity)) {418 foreach ($propertiesForEntity as $pfe) {419 $pfe->items = [];420 $pfe->items[] = new \stdClass();421 $pfe->items[0]->value = null;422 $data->content[] = $pfe;423 }424 }425 }426 return $data;427 }428 private function getIterator()429 {430 return \__ObjectFactory::createModelIterator('ICARICCU\PEB\Models\OntologyManager');431 }432}...

Full Screen

Full Screen

array_017.phpt

Source:array_017.phpt Github

copy

Full Screen

...61 {62 echo __METHOD__ . "($flags)\n";63 ArrayObject::setFlags($flags);64 }65 function getIterator()66 {67 echo __METHOD__ . "()\n";68 $it = new ArrayIteratorEx($this, $this->getFlags());69 $it->dyn2 = 5;70 $it->dump();71 return $it;72 }73}74function check($obj, $flags)75{76 echo "===CHECK===\n";77 $obj->setFlags($flags);78 $obj->dump();79 $obj->show();80 echo "===FOREACH===\n";81 $it = $obj->getIterator();82 foreach($it as $n => $v)83 {84 var_dump(array($n => $v));85 }86 echo "===PROPERTY===\n";87 var_dump($obj->pub1);88 var_dump(isset($obj->a));89 $obj->setFlags($flags | 2);90 var_dump($obj->pub1);91 var_dump(isset($obj->a));92 var_dump($it->pub2);93 var_dump(isset($it->pub1));94 $it->setFlags($flags | 2);95 var_dump($it->pub2);96 var_dump(isset($it->pub1));97}98$obj = new ArrayObjectEx(array(0=>1,'a'=>25, 'pub1'=>42), 0);99$obj->dyn1 = 5;100check($obj, 0);101check($obj, 1);102echo "#####EXCHANGE#####\n";103$obj->exchange();104check($obj, 0);105check($obj, 1);106?>107--EXPECTF--108ArrayObjectEx::__construct()109===CHECK===110ArrayObjectEx::setFlags(0)111ArrayObjectEx::dump()112array(3) {113 ["Flags"]=>114 int(0)115 ["OVars"]=>116 array(5) {117 ["pub1"]=>118 int(1)119 ["pro1"]=>120 int(2)121 ["pri1"]=>122 int(3)123 ["imp1"]=>124 int(4)125 ["dyn1"]=>126 int(5)127 }128 ["$this"]=>129 object(ArrayObjectEx)#%d (6) {130 ["pub1"]=>131 int(1)132 ["pro1":protected]=>133 int(2)134 ["pri1":"ArrayObjectEx":private]=>135 int(3)136 ["imp1"]=>137 int(4)138 ["dyn1"]=>139 int(5)140 ["storage":"ArrayObject":private]=>141 array(3) {142 [0]=>143 int(1)144 ["a"]=>145 int(25)146 ["pub1"]=>147 int(42)148 }149 }150}151ArrayObjectEx::show()152ArrayObjectEx::getIterator()153ArrayIteratorEx::__construct()154ArrayIteratorEx::dump()155array(3) {156 ["Flags"]=>157 int(0)158 ["OVars"]=>159 array(5) {160 ["pub2"]=>161 int(1)162 ["pro2"]=>163 int(2)164 ["pri2"]=>165 int(3)166 ["imp2"]=>167 int(4)168 ["dyn2"]=>169 int(5)170 }171 ["$this"]=>172 object(ArrayIteratorEx)#%d (6) {173 ["pub2"]=>174 int(1)175 ["pro2":protected]=>176 int(2)177 ["pri2":"ArrayIteratorEx":private]=>178 int(3)179 ["imp2"]=>180 int(4)181 ["dyn2"]=>182 int(5)183 ["storage":"ArrayIterator":private]=>184 object(ArrayObjectEx)#%d (6) {185 ["pub1"]=>186 int(1)187 ["pro1":protected]=>188 int(2)189 ["pri1":"ArrayObjectEx":private]=>190 int(3)191 ["imp1"]=>192 int(4)193 ["dyn1"]=>194 int(5)195 ["storage":"ArrayObject":private]=>196 array(3) {197 [0]=>198 int(1)199 ["a"]=>200 int(25)201 ["pub1"]=>202 int(42)203 }204 }205 }206}207array(1) {208 [0]=>209 int(1)210}211array(1) {212 ["a"]=>213 int(25)214}215array(1) {216 ["pub1"]=>217 int(42)218}219===FOREACH===220ArrayObjectEx::getIterator()221ArrayIteratorEx::__construct()222ArrayIteratorEx::dump()223array(3) {224 ["Flags"]=>225 int(0)226 ["OVars"]=>227 array(5) {228 ["pub2"]=>229 int(1)230 ["pro2"]=>231 int(2)232 ["pri2"]=>233 int(3)234 ["imp2"]=>235 int(4)236 ["dyn2"]=>237 int(5)238 }239 ["$this"]=>240 object(ArrayIteratorEx)#%d (6) {241 ["pub2"]=>242 int(1)243 ["pro2":protected]=>244 int(2)245 ["pri2":"ArrayIteratorEx":private]=>246 int(3)247 ["imp2"]=>248 int(4)249 ["dyn2"]=>250 int(5)251 ["storage":"ArrayIterator":private]=>252 object(ArrayObjectEx)#%d (6) {253 ["pub1"]=>254 int(1)255 ["pro1":protected]=>256 int(2)257 ["pri1":"ArrayObjectEx":private]=>258 int(3)259 ["imp1"]=>260 int(4)261 ["dyn1"]=>262 int(5)263 ["storage":"ArrayObject":private]=>264 array(3) {265 [0]=>266 int(1)267 ["a"]=>268 int(25)269 ["pub1"]=>270 int(42)271 }272 }273 }274}275array(1) {276 [0]=>277 int(1)278}279array(1) {280 ["a"]=>281 int(25)282}283array(1) {284 ["pub1"]=>285 int(42)286}287===PROPERTY===288int(1)289bool(false)290ArrayObjectEx::setFlags(2)291int(1)292bool(true)293int(1)294bool(false)295ArrayIteratorEx::setFlags(2)296int(1)297bool(true)298===CHECK===299ArrayObjectEx::setFlags(1)300ArrayObjectEx::dump()301array(3) {302 ["Flags"]=>303 int(1)304 ["OVars"]=>305 array(5) {306 ["pub1"]=>307 int(1)308 ["pro1"]=>309 int(2)310 ["pri1"]=>311 int(3)312 ["imp1"]=>313 int(4)314 ["dyn1"]=>315 int(5)316 }317 ["$this"]=>318 object(ArrayObjectEx)#%d (6) {319 ["pub1"]=>320 int(1)321 ["pro1":protected]=>322 int(2)323 ["pri1":"ArrayObjectEx":private]=>324 int(3)325 ["imp1"]=>326 int(4)327 ["dyn1"]=>328 int(5)329 ["storage":"ArrayObject":private]=>330 array(3) {331 [0]=>332 int(1)333 ["a"]=>334 int(25)335 ["pub1"]=>336 int(42)337 }338 }339}340ArrayObjectEx::show()341ArrayObjectEx::getIterator()342ArrayIteratorEx::__construct()343ArrayIteratorEx::dump()344array(3) {345 ["Flags"]=>346 int(1)347 ["OVars"]=>348 array(5) {349 ["pub2"]=>350 int(1)351 ["pro2"]=>352 int(2)353 ["pri2"]=>354 int(3)355 ["imp2"]=>356 int(4)357 ["dyn2"]=>358 int(5)359 }360 ["$this"]=>361 object(ArrayIteratorEx)#%d (6) {362 ["pub2"]=>363 int(1)364 ["pro2":protected]=>365 int(2)366 ["pri2":"ArrayIteratorEx":private]=>367 int(3)368 ["imp2"]=>369 int(4)370 ["dyn2"]=>371 int(5)372 ["storage":"ArrayIterator":private]=>373 object(ArrayObjectEx)#%d (6) {374 ["pub1"]=>375 int(1)376 ["pro1":protected]=>377 int(2)378 ["pri1":"ArrayObjectEx":private]=>379 int(3)380 ["imp1"]=>381 int(4)382 ["dyn1"]=>383 int(5)384 ["storage":"ArrayObject":private]=>385 array(3) {386 [0]=>387 int(1)388 ["a"]=>389 int(25)390 ["pub1"]=>391 int(42)392 }393 }394 }395}396array(1) {397 [0]=>398 int(1)399}400array(1) {401 ["a"]=>402 int(25)403}404array(1) {405 ["pub1"]=>406 int(42)407}408===FOREACH===409ArrayObjectEx::getIterator()410ArrayIteratorEx::__construct()411ArrayIteratorEx::dump()412array(3) {413 ["Flags"]=>414 int(1)415 ["OVars"]=>416 array(5) {417 ["pub2"]=>418 int(1)419 ["pro2"]=>420 int(2)421 ["pri2"]=>422 int(3)423 ["imp2"]=>424 int(4)425 ["dyn2"]=>426 int(5)427 }428 ["$this"]=>429 object(ArrayIteratorEx)#%d (6) {430 ["pub2"]=>431 int(1)432 ["pro2":protected]=>433 int(2)434 ["pri2":"ArrayIteratorEx":private]=>435 int(3)436 ["imp2"]=>437 int(4)438 ["dyn2"]=>439 int(5)440 ["storage":"ArrayIterator":private]=>441 object(ArrayObjectEx)#%d (6) {442 ["pub1"]=>443 int(1)444 ["pro1":protected]=>445 int(2)446 ["pri1":"ArrayObjectEx":private]=>447 int(3)448 ["imp1"]=>449 int(4)450 ["dyn1"]=>451 int(5)452 ["storage":"ArrayObject":private]=>453 array(3) {454 [0]=>455 int(1)456 ["a"]=>457 int(25)458 ["pub1"]=>459 int(42)460 }461 }462 }463}464array(1) {465 [0]=>466 int(1)467}468array(1) {469 ["a"]=>470 int(25)471}472array(1) {473 ["pub1"]=>474 int(42)475}476===PROPERTY===477int(1)478bool(false)479ArrayObjectEx::setFlags(3)480int(1)481bool(true)482int(1)483bool(false)484ArrayIteratorEx::setFlags(3)485int(1)486bool(true)487#####EXCHANGE#####488ArrayObjectEx::exchange()489===CHECK===490ArrayObjectEx::setFlags(0)491ArrayObjectEx::dump()492array(3) {493 ["Flags"]=>494 int(0)495 ["OVars"]=>496 array(5) {497 ["pub1"]=>498 int(1)499 ["pro1"]=>500 int(2)501 ["pri1"]=>502 int(3)503 ["imp1"]=>504 int(4)505 ["dyn1"]=>506 int(5)507 }508 ["$this"]=>509 object(ArrayObjectEx)#%d (5) {510 ["pub1"]=>511 int(1)512 ["pro1":protected]=>513 int(2)514 ["pri1":"ArrayObjectEx":private]=>515 int(3)516 ["imp1"]=>517 int(4)518 ["dyn1"]=>519 int(5)520 }521}522ArrayObjectEx::show()523ArrayObjectEx::getIterator()524ArrayIteratorEx::__construct()525ArrayIteratorEx::dump()526array(3) {527 ["Flags"]=>528 int(0)529 ["OVars"]=>530 array(5) {531 ["pub2"]=>532 int(1)533 ["pro2"]=>534 int(2)535 ["pri2"]=>536 int(3)537 ["imp2"]=>538 int(4)539 ["dyn2"]=>540 int(5)541 }542 ["$this"]=>543 object(ArrayIteratorEx)#%d (6) {544 ["pub2"]=>545 int(1)546 ["pro2":protected]=>547 int(2)548 ["pri2":"ArrayIteratorEx":private]=>549 int(3)550 ["imp2"]=>551 int(4)552 ["dyn2"]=>553 int(5)554 ["storage":"ArrayIterator":private]=>555 object(ArrayObjectEx)#%d (5) {556 ["pub1"]=>557 int(1)558 ["pro1":protected]=>559 int(2)560 ["pri1":"ArrayObjectEx":private]=>561 int(3)562 ["imp1"]=>563 int(4)564 ["dyn1"]=>565 int(5)566 }567 }568}569array(1) {570 ["pub1"]=>571 int(1)572}573array(1) {574 ["imp1"]=>575 int(4)576}577array(1) {578 ["dyn1"]=>579 int(5)580}581===FOREACH===582ArrayObjectEx::getIterator()583ArrayIteratorEx::__construct()584ArrayIteratorEx::dump()585array(3) {586 ["Flags"]=>587 int(0)588 ["OVars"]=>589 array(5) {590 ["pub2"]=>591 int(1)592 ["pro2"]=>593 int(2)594 ["pri2"]=>595 int(3)596 ["imp2"]=>597 int(4)598 ["dyn2"]=>599 int(5)600 }601 ["$this"]=>602 object(ArrayIteratorEx)#%d (6) {603 ["pub2"]=>604 int(1)605 ["pro2":protected]=>606 int(2)607 ["pri2":"ArrayIteratorEx":private]=>608 int(3)609 ["imp2"]=>610 int(4)611 ["dyn2"]=>612 int(5)613 ["storage":"ArrayIterator":private]=>614 object(ArrayObjectEx)#%d (5) {615 ["pub1"]=>616 int(1)617 ["pro1":protected]=>618 int(2)619 ["pri1":"ArrayObjectEx":private]=>620 int(3)621 ["imp1"]=>622 int(4)623 ["dyn1"]=>624 int(5)625 }626 }627}628array(1) {629 ["pub1"]=>630 int(1)631}632array(1) {633 ["imp1"]=>634 int(4)635}636array(1) {637 ["dyn1"]=>638 int(5)639}640===PROPERTY===641int(1)642bool(false)643ArrayObjectEx::setFlags(2)644int(1)645bool(false)646int(1)647bool(false)648ArrayIteratorEx::setFlags(2)649int(1)650bool(true)651===CHECK===652ArrayObjectEx::setFlags(1)653ArrayObjectEx::dump()654array(3) {655 ["Flags"]=>656 int(1)657 ["OVars"]=>658 array(5) {659 ["pub1"]=>660 int(1)661 ["pro1"]=>662 int(2)663 ["pri1"]=>664 int(3)665 ["imp1"]=>666 int(4)667 ["dyn1"]=>668 int(5)669 }670 ["$this"]=>671 object(ArrayObjectEx)#%d (5) {672 ["pub1"]=>673 int(1)674 ["pro1":protected]=>675 int(2)676 ["pri1":"ArrayObjectEx":private]=>677 int(3)678 ["imp1"]=>679 int(4)680 ["dyn1"]=>681 int(5)682 }683}684ArrayObjectEx::show()685ArrayObjectEx::getIterator()686ArrayIteratorEx::__construct()687ArrayIteratorEx::dump()688array(3) {689 ["Flags"]=>690 int(1)691 ["OVars"]=>692 array(5) {693 ["pub2"]=>694 int(1)695 ["pro2"]=>696 int(2)697 ["pri2"]=>698 int(3)699 ["imp2"]=>700 int(4)701 ["dyn2"]=>702 int(5)703 }704 ["$this"]=>705 object(ArrayIteratorEx)#%d (6) {706 ["pub2"]=>707 int(1)708 ["pro2":protected]=>709 int(2)710 ["pri2":"ArrayIteratorEx":private]=>711 int(3)712 ["imp2"]=>713 int(4)714 ["dyn2"]=>715 int(5)716 ["storage":"ArrayIterator":private]=>717 object(ArrayObjectEx)#%d (5) {718 ["pub1"]=>719 int(1)720 ["pro1":protected]=>721 int(2)722 ["pri1":"ArrayObjectEx":private]=>723 int(3)724 ["imp1"]=>725 int(4)726 ["dyn1"]=>727 int(5)728 }729 }730}731array(1) {732 ["pub1"]=>733 int(1)734}735array(1) {736 ["imp1"]=>737 int(4)738}739array(1) {740 ["dyn1"]=>741 int(5)742}743===FOREACH===744ArrayObjectEx::getIterator()745ArrayIteratorEx::__construct()746ArrayIteratorEx::dump()747array(3) {748 ["Flags"]=>749 int(1)750 ["OVars"]=>751 array(5) {752 ["pub2"]=>753 int(1)754 ["pro2"]=>755 int(2)756 ["pri2"]=>757 int(3)758 ["imp2"]=>...

Full Screen

Full Screen

DatabaseEntity.php

Source:DatabaseEntity.php Github

copy

Full Screen

...22 $this->assertEquals(2, count($collection));23 $this->assertEquals(2, $collection->count());24 25 $expected = array($node1->nodeId, $node2->nodeId);26 $actual = array_values(SyndLib::collect($collection->getIterator(0, null, array($query->getPrimaryKey())), 'nodeId'));27 $this->assertEquals($expected, $actual);28 $expected = array($node1->nodeId, $node2->nodeId);29 $actual = array_values(SyndLib::collect($collection->getIterator(0, 2, array($query->getPrimaryKey())), 'nodeId'));30 $this->assertEquals($expected, $actual);31 $expected = array($node1->nodeId);32 $actual = array_values(SyndLib::collect($collection->getIterator(0, 1, array($query->getPrimaryKey())), 'nodeId'));33 $this->assertEquals($expected, $actual);34 $expected = array($node2->nodeId);35 $actual = array_values(SyndLib::collect($collection->getIterator(1, 1, array($query->getPrimaryKey())), 'nodeId'));36 $this->assertEquals($expected, $actual);37 38 $node1->delete();39 $node2->delete();40 }41 42 function testAggregateCollection() {43 $storage = SyndNodeLib::getDefaultStorage('issue');44 $project = $storage->factory('project');45 $project->setTitle('_unit_test: This project is safe to delete');46 $project->save();47 48 $issue = $project->appendChild($storage->factory('issue'));49 $issue->setTitle('_unit_test: This issue is safe to delete');50 $issue->save();51 52 $note1 = $issue->appendChild($storage->factory('task'));53 $note1->data['CREATE_NODE_ID'] = 'user_null.a';54 $note1->save();55 $note2 = $issue->appendChild($storage->factory('task'));56 $note2->data['CREATE_NODE_ID'] = 'user_null.c';57 $note2->save();58 59 $storage->flush();60 $collection = $issue->getNotes();61 62 // Test iteration63 $actual = array_values(SyndLib::collect($collection->getIterator(0, null, array('CREATE_NODE_ID')), 'nodeId'));64 $this->assertEquals(array($note1->nodeId, $note2->nodeId), $actual);65 66 // Test append67 $note3 = $collection->append($storage->factory('task'));68 $note3->data['CREATE_NODE_ID'] = 'user_null.d';69 $actual = array_values(SyndLib::collect($collection->getIterator(0, null, array('CREATE_NODE_ID', false)), 'nodeId'));70 $this->assertEquals(array($note3->nodeId, $note2->nodeId, $note1->nodeId), $actual);71 72 // Test append73 $note4 = $collection->append($storage->factory('task'));74 $note4->data['CREATE_NODE_ID'] = 'user_null.b';75 $actual = array_values(SyndLib::collect($collection->getIterator(0, null, array('CREATE_NODE_ID')), 'nodeId'));76 $this->assertEquals(array($note1->nodeId, $note4->nodeId, $note2->nodeId, $note3->nodeId), $actual);77 $actual = array_values(SyndLib::collect($collection->getIterator(0, 2, array('CREATE_NODE_ID')), 'nodeId'));78 $this->assertEquals(array($note1->nodeId, $note4->nodeId), $actual);79 $actual = array_values(SyndLib::collect($collection->getIterator(1, 10, array('CREATE_NODE_ID')), 'nodeId'));80 $this->assertEquals(array($note4->nodeId, $note2->nodeId, $note3->nodeId), $actual);81 $actual = array_values(SyndLib::collect($collection->getIterator(1, 2, array('CREATE_NODE_ID')), 'nodeId'));82 $this->assertEquals(array($note4->nodeId, $note2->nodeId), $actual);83 $actual = array_values(SyndLib::collect($collection->getIterator(2, 2, array('CREATE_NODE_ID')), 'nodeId'));84 $this->assertEquals(array($note2->nodeId, $note3->nodeId), $actual);85 // Test remove86 $collection->remove($note1);87 $collection->remove($note4);88 $actual = array_values(SyndLib::collect($collection->getIterator(0, null, array('CREATE_NODE_ID')), 'nodeId'));89 $this->assertEquals(array($note2->nodeId, $note3->nodeId), $actual);90 91 // Test persistence92 $note3->save();93 $note3->flush();94 $collection->flush();95 96 $actual = array_values(SyndLib::collect($collection->getIterator(0, null, array('CREATE_NODE_ID', false)), 'nodeId'));97 $this->assertEquals(array($note3->nodeId, $note2->nodeId, $note1->nodeId), $actual);98 99 $database = $storage->getDatabase();100 $sql = "101 SELECT t.node_id FROM synd_issue_task t102 WHERE t.parent_node_id = ".$database->quote($issue->nodeId);103 $actual = $database->getCol($sql);104 natsort($actual);105 $this->assertEquals(array($note1->nodeId, $note2->nodeId, $note3->nodeId), $actual);106 107 // Test serialize108 $collection2 = unserialize(serialize($collection));109 $actual = array_values(SyndLib::collect($collection2->getIterator(0, null, array('CREATE_NODE_ID', false)), 'nodeId'));110 $this->assertEquals(array($note3->nodeId, $note2->nodeId, $note1->nodeId), $actual);111 $issue->delete();112 $project->delete();113 }114}...

Full Screen

Full Screen

getIterator

Using AI Code Generation

copy

Full Screen

1$storage = new Storage();2$storage->getIterator();3$storage = new Storage();4$storage->getIterator();5$storage = new Storage();6$storage->getIterator();7$storage = new Storage();8$storage->getIterator();9$storage = new Storage();10$storage->getIterator();11$storage = new Storage();12$storage->getIterator();13$storage = new Storage();14$storage->getIterator();15$storage = new Storage();16$storage->getIterator();17$storage = new Storage();18$storage->getIterator();19$storage = new Storage();20$storage->getIterator();21$storage = new Storage();22$storage->getIterator();23$storage = new Storage();24$storage->getIterator();25$storage = new Storage();26$storage->getIterator();27$storage = new Storage();28$storage->getIterator();29$storage = new Storage();30$storage->getIterator();31$storage = new Storage();32$storage->getIterator();33$storage = new Storage();34$storage->getIterator();

Full Screen

Full Screen

getIterator

Using AI Code Generation

copy

Full Screen

1require_once 'Storage.php';2$storage = new Storage();3$storage->set('a', 'A');4$storage->set('b', 'B');5$storage->set('c', 'C');6$storage->set('d', 'D');7$storage->set('e', 'E');8$storage->set('f', 'F');9$storage->set('g', 'G');10$storage->set('h', 'H');11$storage->set('i', 'I');12$storage->set('j', 'J');13$storage->set('k', 'K');14$storage->set('l', 'L');15$storage->set('m', 'M');16$storage->set('n', 'N');17$storage->set('o', 'O');18$storage->set('p', 'P');19$storage->set('q', 'Q');20$storage->set('r', 'R');21$storage->set('s', 'S');22$storage->set('t', 'T');23$storage->set('u', 'U');24$storage->set('v', 'V');25$storage->set('w', 'W');26$storage->set('x', 'X');27$storage->set('y', 'Y');28$storage->set('z', 'Z');29foreach ($storage as $key => $value) {30';31}32require_once 'Storage.php';33$storage = new Storage();34$storage->set('a', 'A');35$storage->set('b', 'B');36$storage->set('c', 'C');37$storage->set('d', 'D');38$storage->set('e', 'E');39$storage->set('f', 'F');40$storage->set('g', 'G');41$storage->set('h', 'H');42$storage->set('i', 'I');43$storage->set('j', 'J');44$storage->set('k', 'K');45$storage->set('l', 'L');46$storage->set('m', 'M');47$storage->set('n', 'N');48$storage->set('o', 'O');49$storage->set('p', 'P');50$storage->set('q', 'Q');

Full Screen

Full Screen

getIterator

Using AI Code Generation

copy

Full Screen

1include 'storage.php';2$storage = new storage();3$storage->set('name', 'value');4$storage->set('name2', 'value2');5$storage->set('name3', 'value3');6$storage->set('name4', 'value4');7$storage->set('name5', 'value5');8$storage->set('name6', 'value6');9$storage->set('name7', 'value7');10$storage->set('name8', 'value8');11$storage->set('name9', 'value9');12$storage->set('name10', 'value10');13$storage->set('name11', 'value11');14$storage->set('name12', 'value12');15$storage->set('name13', 'value13');16$storage->set('name14', 'value14');17$storage->set('name15', 'value15');18$storage->set('name16', 'value16');19$storage->set('name17', 'value17');20$storage->set('name18', 'value18');21$storage->set('name19', 'value19');22$storage->set('name20', 'value20');23$storage->set('name21', 'value21');24$storage->set('name22', 'value22');25$storage->set('name23', 'value23');26$storage->set('name24', 'value24');27$storage->set('name25', 'value25');28$storage->set('name26', 'value26');29$storage->set('name27', 'value27');30$storage->set('name28', 'value28');31$storage->set('name29', 'value29');32$storage->set('name30', 'value30');33$storage->set('name31', 'value31');34$storage->set('name32', 'value32');35$storage->set('name33', 'value33');36$storage->set('name34', 'value34');37$storage->set('name35', 'value35');38$storage->set('name36', 'value36');39$storage->set('name37', 'value37');40$storage->set('name38', 'value38');41$storage->set('name39', 'value39');42$storage->set('name40', 'value40');43$storage->set('name41', '

Full Screen

Full Screen

getIterator

Using AI Code Generation

copy

Full Screen

1$storage = new Storage();2$storage->getIterator()->getArrayCopy();3PHP | Count number of elements in an array using count() function4PHP | Count number of elements in an array using sizeof() function5PHP | Count number of elements in an array using count() function6PHP | Count number of elements in an array using count() function7How to count number of elements in an array using count() function in PHP ?8How to count number of elements in an array using sizeof() function in PHP ?9How to count number of elements in an array using count() function in PHP ?

Full Screen

Full Screen

getIterator

Using AI Code Generation

copy

Full Screen

1$storage = new SplFileObject('1.php');2$storage->setFlags(SplFileObject::SKIP_EMPTY | SplFileObject::DROP_NEW_LINE);3$storage->setCsvControl(' ', ' ', '"');4$storage->setFlags(SplFileObject::READ_AHEAD | SplFileObject::SKIP_EMPTY);5$storage->setFlags(SplFileObject::READ_CSV);6$storage->setFlags(SplFileObject::READ_AHEAD | SplFileObject::SKIP_EMPTY);7$storage->setFlags(SplFileObject::READ_CSV);8$storage->setFlags(SplFileObject::READ_AHEAD | SplFileObject::SKIP_EMPTY);9$storage->setFlags(SplFileObject::READ_CSV);10$storage->setFlags(SplFileObject::READ_AHEAD | SplFileObject::SKIP_EMPTY);11$storage->setFlags(SplFileObject::READ_CSV);12$storage->setFlags(SplFileObject::READ_AHEAD | SplFileObject::SKIP_EMPTY);13$storage->setFlags(SplFileObject::READ_CSV);14$storage->setFlags(SplFileObject::READ_AHEAD | SplFileObject::SKIP_EMPTY);15$storage->setFlags(SplFileObject::READ_CSV);16$storage->setFlags(SplFileObject::READ_AHEAD | SplFileObject::SKIP_EMPTY);17$storage->setFlags(SplFileObject::READ_CSV);18$storage->setFlags(SplFileObject::READ_AHEAD | SplFileObject::SKIP_EMPTY);19$storage->setFlags(SplFileObject::READ_CSV);20$storage->setFlags(SplFileObject::READ_AHEAD | SplFileObject::SKIP_EMPTY);21$storage->setFlags(SplFileObject::READ_CSV);22$storage->setFlags(SplFileObject::READ_AHEAD | SplFileObject::SKIP_EMPTY);23$storage->setFlags(SplFileObject::READ_CSV);24$storage->setFlags(SplFileObject::READ_AHEAD | SplFileObject::SKIP_EMPTY);25$storage->setFlags(SplFileObject::READ_CSV);26$storage->setFlags(SplFileObject::READ_AHEAD | SplFileObject::SKIP_EMPTY);27$storage->setFlags(SplFileObject::READ_CSV);28$storage->setFlags(SplFileObject::READ_AHEAD | SplFileObject::SKIP_EMPTY);29$storage->setFlags(SplFileObject::READ_CSV);30$storage->setFlags(SplFileObject::READ_A

Full Screen

Full Screen

getIterator

Using AI Code Generation

copy

Full Screen

1$storage = new Storage();2$iterator = $storage->getIterator();3foreach($iterator as $key => $value) {4";5}6$storage = new Storage();7$iterator = $storage->getIterator();8foreach($iterator as $key => $value) {9";10}11$storage = new Storage();12$iterator = $storage->getIterator();13foreach($iterator as $key => $value) {14";15}16$storage = new Storage();17$iterator = $storage->getIterator();18foreach($iterator as $key => $value) {19";20}21$storage = new Storage();22$iterator = $storage->getIterator();23foreach($iterator as $key => $value) {24";25}26$storage = new Storage();27$iterator = $storage->getIterator();28foreach($iterator as $key => $value) {29";30}31$storage = new Storage();32$iterator = $storage->getIterator();33foreach($iterator as $key => $value) {34";35}36$storage = new Storage();37$iterator = $storage->getIterator();38foreach($iterator as $key => $value) {

Full Screen

Full Screen

getIterator

Using AI Code Generation

copy

Full Screen

1$storage = new Storage();2$storage->setPath('data');3$storage->setFile('data.txt');4$storage->setMode('r');5$storage->setDelimiter('|');6$storage->setEnclosure('\"');7$storage->setEscape('\\');8$storage->setLineEnding('\r9');10$storage->setHeader(true);11$storage->setHeaderRow(1);12$storage->setRow(1);13$storage->setIterator(1);14$storage->setLimit(10);15$storage->setOffset(0);16$storage->setCount(1);17$storage->setLimit(10);18$storage->setOffset(0);19$storage->setCount(1);20$storage->setFilter('id', 5);21$storage->setFilter('id', 5, '>');22$storage->setFilter('id', 5, '>=', 'OR');23$storage->setFilter('id', 5, '>=', 'AND');24$storage->setFilter('id', 5, '>=', 'AND');25$storage->setFilter('id', array(5, 6, 7), 'IN');26$storage->setFilter('id', array(5, 6, 7), 'NOT IN');27$storage->setFilter('id', array(5, 6, 7), 'IN', 'OR');28$storage->setFilter('id', array(5, 6, 7), 'NOT IN', 'OR');29$storage->setFilter('id', array(5, 6, 7), 'IN', 'AND');30$storage->setFilter('id', array(5, 6, 7), 'NOT IN', 'AND');31$storage->setFilter('id', 5, 'LIKE');32$storage->setFilter('id', 5, 'NOT LIKE');33$storage->setFilter('id', 5, 'LIKE', 'OR');34$storage->setFilter('id', 5, 'NOT LIKE', 'OR');35$storage->setFilter('id', 5, 'LIKE', 'AND');36$storage->setFilter('id', 5, 'NOT LIKE', 'AND');37$storage->setFilter('id', 5, '<>');38$storage->setFilter('id', 5, '<>', 'OR');39$storage->setFilter('id', 5

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Atoum automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Trigger getIterator code on LambdaTest Cloud Grid

Execute automation tests with getIterator on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful