Created
October 15, 2014 13:28
-
-
Save digitalkaoz/87597339dd7df680f8ff to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class EdmaParser implements Parser | |
{ | |
const TYPE = 'EDMA attribute'; | |
public function parse($source, array &$joins, array &$wheres, &$nos) | |
{ | |
$attr = (int) $source['attribute'][$i]; | |
$value = $source['valuei'][$i]; | |
if (is_numeric(str_replace(',', '.', $value))) { | |
$value = (float) str_replace(',', '.', $value); | |
} | |
$joins[] = "JOIN cf_metadata md$no on md$no.entity_id = e.id"; | |
$wheres[] = [$this->formatCondition("md$no.meta_type_id = $attr AND md$no.value", $op, is_float($value)), $value]; | |
if (! ($last || $nrb)) { | |
$wheres[] = $comp; | |
} | |
$nos++; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ParserDispatcher implements Parser | |
{ | |
public function parse($source, array &$joins, array &$wheres, &$nos) | |
{ | |
switch $source | |
{ | |
case EdmaParser::TYPE : (new EdmaParser())->parse($source, $joins, $wheres, $nos); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment