/** * Instantiates a new instance of this object from a string * * @param String $string The string to parse into an object * @return \r8\Query\Atom\Field */ public static function fromString($string) { $parsed = \r8\Query::parseSQLName($string); $field = new self(array_pop($parsed)); if (count($parsed) > 0) { $field->setTable(array_pop($parsed)); } if (count($parsed) > 0) { $field->setDatabase(array_pop($parsed)); } return $field; }
/** * Instantiates a new instance of this object from a string * * @param String $string The string to parse into an object * @return \r8\Query\From\Table */ public static function fromString($string) { list($string, $alias) = \r8\Query::parseSQLAlias($string); // Split the name into the table and database $parsed = \r8\Query::parseSQLName($string); // Instantiate with the table name $field = new self(array_pop($parsed)); // Set the database if we found one if (count($parsed) > 0) { $field->setDatabase(array_pop($parsed)); } // Now load in the alias if ($alias) { $field->setAlias($alias); } return $field; }