I am unclear here! I got error Notice: Undefined variable: filter
when running below code!
But when I remove declare public $filter
line,It worked !!! Why ?
use Phalcon\Filter;
class Auth extends Component {
public $filter;//remove this line is working
public function initialize() {
$this->db = $this->getDI()->getShared("db");
$this->login_db = $this->getDI()->getShared("login_db");
$this->filter = new Filter();
}
public function auth($name) {
$name = $this->filter->sanitize($name,"string");
}
}