Advertisement
fruffl

Marshal

Oct 13th, 2012
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.75 KB | None | 0 0
  1. <?PHP
  2.  
  3. namespace localhost\illiFW\dev;
  4.  
  5. use ILLI\Core\Marshal\Collection\Builder as CollectionBuilder;
  6. use ILLI\Core\Marshal\Record\Builder as RecordBuilder;
  7. use ILLI\Core\Marshal\Relation\Builder as RelationBuilder;
  8. use ILLI\Core\Marshal\Collection\Generic as GenericCollection;
  9. use ILLI\Core\Marshal\Record\Generic as GenericRecord;
  10. use ILLI\Core\Marshal\Type\Builder as TypeBuilder;
  11. use ILLI\Core\Marshal\Type\Generic as GenericType;
  12. use ILLI\Core\Marshal\Manager as Manager;
  13. use ILLI\Core\Marshal\iManager as iManager;
  14. use ILLI\Core\Marshal\Type\iType as iType;
  15. use ILLI\Core\Marshal\Relation\iRelation as iRelation;
  16.  
  17. require_once 'ILLI/illi.php';
  18.  
  19. try
  20. {
  21.     \Server\Init::setup();
  22.     \Server\Init::development();
  23.     \Server\Init::debug();
  24.     \Server\Init::illi();
  25.    
  26.     $info = (new \ILLI\Core\Web\Controller\Controller)->collect('posts')->fromDB;
  27.        
  28.         $type = new GenericType;
  29.         $type->setIdentityField($info[iType::PROP_IDENTIFY_FIELD]);
  30.         $type->setIndexFields($info[iType::PROP_INDEX_FIELDS]);
  31.         $type->setRecordClass('\ILLI\Marshal\Record\Generic');
  32.         $type->setRecordBuilder(new RecordBuilder);
  33.         $type->setCollectionBuilder(new CollectionBuilder);
  34.        
  35.         var_dump($type);
  36.  
  37.         $type_builder = new TypeBuilder;
  38.         $relation_builder = new RelationBuilder;
  39.         $manager = new Manager($type_builder, $relation_builder, $types);
  40.         foreach($manager->getTypes() as $type) {
  41.        
  42.             $obj = $manager->{$type}->load($data[$type]);
  43.         }
  44.        
  45.         var_dump($manager);
  46.  
  47. }
  48. catch(\Exception $e)
  49. {
  50.     print PHP_EOL;
  51.     print PHP_EOL;
  52.     print '{{{ ';
  53.     print PHP_EOL;
  54.     print __FILE__.'@'.__LINE__;
  55.     print PHP_EOL;
  56.     var_dump($e);
  57.     print PHP_EOL;
  58.     print '}}}';
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement