Skip to content

Instantly share code, notes, and snippets.

@digitalkaoz
Created October 15, 2014 13:28
Show Gist options
  • Save digitalkaoz/87597339dd7df680f8ff to your computer and use it in GitHub Desktop.
Save digitalkaoz/87597339dd7df680f8ff to your computer and use it in GitHub Desktop.
<?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++;
}
}
<?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