Skip to content

Instantly share code, notes, and snippets.

@renepardon
Created October 6, 2011 17:31
Show Gist options
  • Save renepardon/1268040 to your computer and use it in GitHub Desktop.
Save renepardon/1268040 to your computer and use it in GitHub Desktop.
to much magic?
<?php
public function __call($name, $arguments)
{
if (preg_match('#^findBy(.*)#', $name, $matches)) {
$colName = strtolower($this->_filter->filter($matches[1]));
return $this->_returnCollection(
$this->_table->fetchAll(array($colName . '=?' => $arguments[0]))
);
} else {
return call_user_func_array(array($this->_table, $name), $arguments);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment