No logro entender que esta mal.
Código PHP:
class SPDO
{
static $dbh;
public function __construct()
{
try
{
$dsn = 'mysql:host=' . HOST . ';dbname=' . DATABASE;
self::$dbh = new PDO($dsn, USER, PASSWORD);
}
catch (PDOException $e)
{
echo 'Connection failed: ' . $e->getMessage();
}
}
public static function getInstance()
{
if (self::$dbh == NULL)
{
self::$dbh = new SPDO();
}
return self::$dbh;
}
}
Código PHP:
class Model
{
public $dbh;
public function __construct()
{
$this->dbh = SPDO::getInstance();
$this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$this->dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, FALSE);
}
}
Cita: (!) Fatal error: Call to undefined method SPDO::setAttribute()