__call() public method

If your Table uses any behaviors you can call them as if they were on the table object.
public __call ( string $method, array $args ) : mixed
$method string name of the method to be invoked
$args array List of arguments passed to the function
return mixed
Example #1
0
 public function __call($method, $args)
 {
     if (preg_match('/^(set|toggle)(?:[A-Z][a-z_]*)+$/', $method, $match) > 0) {
         $method = ltrim($method, $match[1]);
         $fieldName = strtolower(preg_replace('/(?<=\\w)(?=[A-Z])/', '_$1', $method));
         return $this->setField($args[0], $fieldName, !empty($args[1]) ? $args[1] : null);
     } else {
         return parent::__call($method, $args);
     }
 }