Example #1
0
 /**
  * @covers \SweetORM\Structure\Indexer\EntityIndexer
  * @covers \SweetORM\Structure\Indexer\Indexer
  * @covers \SweetORM\Structure\Indexer\TableIndexer
  * @covers \SweetORM\Structure\Indexer\ColumnIndexer
  * @covers \SweetORM\Structure\Indexer\RelationIndexer
  * @covers \SweetORM\Structure\EntityStructure
  */
 public function testEntityAnnotation()
 {
     // Test indexer
     $indexer = new EntityIndexer(Post::class);
     $structure = $indexer->getEntity();
     $this->assertEquals("post", $structure->tableName);
     // Category
     $indexer = new EntityIndexer(Category::class);
     $structure = $indexer->getEntity();
     $this->assertEquals("category", $structure->tableName);
 }
Example #2
0
 /**
  * Register and index Entity class
  * @param string|Entity $entityClassName
  */
 public function registerEntity($entityClassName)
 {
     $indexer = new EntityIndexer($entityClassName);
     $structure = $indexer->getEntity();
     $this->entities[$structure->name] = $structure;
 }