Exemplo n.º 1
0
/**
 * @param null $name - table name of the entity
 * @return Entity
 */
function entity($name = null)
{
    if ($name) {
        $entity = new Entity();
        $entity->setTableName($name);
        return $entity;
    } else {
        return new Entity();
    }
}
Exemplo n.º 2
0
 public function test_entity_table_name()
 {
     $name = 'abc';
     //
     $entity = new \of\Entity();
     test($entity instanceof Entity, 'OK', 'ERROR');
     test(entity() instanceof Entity, 'OK', 'ERROR');
     //
     $entity->setTableName($name);
     test($entity->getTableName() == entity()->adjustTableName($name), 'OK', 'ERROR - table name adjusting failed');
     test($entity->getTableName() == $this->adjustTableName($name), 'OK', 'ERROR');
     //
 }
Exemplo n.º 3
0
 public function setTableName($name)
 {
     $name = $name . '_meta';
     parent::setTableName($name);
 }