I am learning phalcon. I have some problems with models. Function FindFirst returns nothing, also it doesn't show any errors or exceptions. Here is my code:
public function indexAction()
{
$user = Users::findFirst(1);
var_dump($user);
}
And all what I get - is empty page.
Here is my Users Model:
<?php
namespace Models\User;
use Phalcon\Mvc\Model\Validator\Email as Email;
class Users extends \Phalcon\Mvc\Model
{
/**
*
* @var integer
*/
public $id;
/**
*
* @var string
*/
public $login;
/**
*
* @var string
*/
public $email;
public function initialize()
{
$this->setSource("users");
}
/**
* Validations and business logic
*/
public function validation()
{
$this->validate(
new Email(
array(
'field' => 'email',
'required' => true,
)
)
);
if ($this->validationHasFailed() == true) {
return false;
}
}
/**
* Independent Column Mapping.
* Keys are the real names in the table and the values their names in the application
*
* @return array
*/
public function columnMap()
{
return array(
'id' => 'id',
'login' => 'login',
'email' => 'email'
);
}
}
Some additional information: I have edited config files. Phalcon version is 2.0