/** * @param SelectorInterface $selector * * @throws \LogicException * * @return \Cubiche\Core\Selector\Field */ protected function createField(SelectorInterface $selector, $isEntityValue = false) { if ($selector instanceof Selector) { return $this->createField($selector->selector(), $isEntityValue); } if ($selector instanceof Field) { return $selector; } if ($selector instanceof This) { return $isEntityValue ? new Property('id') : null; } if ($selector instanceof Composite) { return $this->createFieldFromComposite($selector); } throw new \LogicException(\sprintf('The %s specification cannot be used in the field name', \get_class($selector))); }
/** * @param SelectorInterface $selector * * @return $this */ public function select(SelectorInterface $selector) { $this->addCurrentSelector(); $this->currentSelector = $selector instanceof Selectors ? $selector->selector() : $selector; return $this; }