Commit a5af988d by Taylor Otwell

Remove comment bloat from dynamic query builder.

parent 34605ad4
...@@ -14,32 +14,21 @@ class Dynamic { ...@@ -14,32 +14,21 @@ class Dynamic {
*/ */
public static function build($method, $parameters, $query) public static function build($method, $parameters, $query)
{ {
// ---------------------------------------------------------
// Strip the "where_" off of the method. // Strip the "where_" off of the method.
// ---------------------------------------------------------
$finder = substr($method, 6); $finder = substr($method, 6);
// ---------------------------------------------------------
// Split the column names from the connectors. // Split the column names from the connectors.
// ---------------------------------------------------------
$segments = preg_split('/(_and_|_or_)/i', $finder, -1, PREG_SPLIT_DELIM_CAPTURE); $segments = preg_split('/(_and_|_or_)/i', $finder, -1, PREG_SPLIT_DELIM_CAPTURE);
// --------------------------------------------------------- // The connector variable will determine which connector will be used for the condition.
// The connector variable will determine which connector // We'll change it as we come across new connectors in the dynamic method string.
// will be used for the condition. We'll change it as we
// come across new connectors in the dynamic method string.
// //
// The index variable helps us get the correct parameter // The index variable helps us get the correct parameter value for the where condition.
// value for the where condition. We increment it each time // We increment it each time we add a condition.
// we add a condition.
// ---------------------------------------------------------
$connector = 'AND'; $connector = 'AND';
$index = 0; $index = 0;
// ---------------------------------------------------------
// Iterate through each segment and add the conditions.
// ---------------------------------------------------------
foreach ($segments as $segment) foreach ($segments as $segment)
{ {
if ($segment != '_and_' and $segment != '_or_') if ($segment != '_and_' and $segment != '_or_')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment