Example #1
0
 /**
  * Builds a mysqli table metadata from an entity class
  * @param $class string
  * @return Table
  */
 public function build($class)
 {
     $class = $this->trimClassName($class);
     if (!is_string($class)) {
         throw new \InvalidArgumentException("argument needs to be a class string");
     }
     if (array_key_exists($class, $this->tables)) {
         return $this->tables[$class];
     }
     $reflectedEntity = new ReflectionClass($class);
     $table = new Table($reflectedEntity, $this);
     $this->tables[$class] = $table;
     $table->setName($this->getTableName($reflectedEntity));
     $this->addTableFields($reflectedEntity, $table);
     return $table;
 }