lithium\data\Model::hasField PHP Method

hasField() public static method

Checks to see if a particular field exists in a model's schema. Can check a single field, or return the first field found in an array of multiple options.
public static hasField ( mixed $field ) : mixed
$field mixed A single field (string) or list of fields (array) to check the existence of.
return mixed If `$field` is a string, returns a boolean indicating whether or not that field exists. If `$field` is an array, returns the first field found, or `false` if none of the fields in the list are found.
    public static function hasField($field)
    {
        if (!is_array($field)) {
            return static::schema()->fields($field);
        }
        foreach ($field as $f) {
            if (static::hasField($f)) {
                return $f;
            }
        }
        return false;
    }