Example #1
0
 private function buildSubPropertyCondition(ComparatorInterface $specification) : SequenceInterface
 {
     $prop = new Str($specification->property());
     $pieces = $prop->split('.');
     $var = (new Str('entity_'))->append($pieces->pop()->join('_'));
     $key = $var->append('_')->append((string) $pieces->last())->append((string) $this->count);
     return new Sequence(sprintf('%s %s %s', $var->append('.')->append((string) $pieces->last()), $specification->sign(), $key->prepend('{')->append('}')), new Collection([(string) $key => $specification->value()]));
 }
Example #2
0
 /**
  * Добавляет вложенное сравнение
  *
  * @param  ComparatorInterface $comparator
  * @return void
  */
 public function addComparator(ComparatorInterface $comparator)
 {
     if ($comparator instanceof AggregateComparator) {
         $this->addComparators($comparator->getComparators());
         return;
     }
     $this->comparators[] = $comparator;
 }
Example #3
0
 private function buildSubPropertyMapping(ComparatorInterface $specification) : MapInterface
 {
     $prop = new Str($specification->property());
     $pieces = $prop->split('.');
     $var = (new Str('entity_'))->append($pieces->pop()->join('_'));
     $key = $var->append('_')->append((string) $pieces->last());
     return (new Map('string', SequenceInterface::class))->put((string) $var, new Sequence(new Collection([(string) $pieces->last() => (string) $key->prepend('{')->append('}')]), new Collection([(string) $key => $specification->value()])));
 }
 private function buildEdgeCondition(ComparatorInterface $specification, RelationshipEdge $edge, string $side) : SequenceInterface
 {
     $key = (new Str($side))->append('_')->append($edge->target())->append((string) $this->count);
     $value = $specification->value();
     if ($value instanceof IdentityInterface) {
         $value = $value->value();
     }
     return new Sequence(sprintf('%s.%s %s %s', $side, $edge->target(), $specification->sign(), $key->prepend('{')->append('}')), new Collection([(string) $key => $value]));
 }
 private function buildEdgeMapping(ComparatorInterface $specification, RelationshipEdge $edge, string $side) : MapInterface
 {
     $key = (new Str($side))->append('_')->append($edge->target());
     $value = $specification->value();
     if ($value instanceof IdentityInterface) {
         $value = $value->value();
     }
     return (new Map('string', SequenceInterface::class))->put($side, new Sequence(new Collection([$edge->target() => (string) $key->prepend('{')->append('}')]), new Collection([(string) $key => $value])));
 }