Get all generators for the given entity

@param mixed $referenceable the object on which the generator should be
applied

@return null|ReferenceGeneratorInterface
8628
public function findAll(ReferenceableInterface $referenceable) {
        $generators = new ReferenceGeneratorCollection();
        
        foreach( $this->generators->all() as $generator ) {
            if( $generator->canHandle($referenceable) ) {
                $generators->add($generator);
            }
        }
        
        return $generators;
    }
205516
public static function getWrapperGenerator(array $yieldables, callable $filter)
    {
        $gens = [];
        foreach ($yieldables as $yieldable) {
            $gens[(string)$yieldable['value']] = $filter($yieldable['value']);
        }
        yield CoInterface::RETURN_WITH => (yield $gens);
        // @codeCoverageIgnoreStart
    }
54528
public function getGenerator()
    {
        if (!$this->generator) {
            $this->generator = Factory::create($this->locale);
        }

        return $this->generator;
    }
1080069
public function getGenerator($name)
    {
        if ($this->hasGenerator($name) === false) {
            throw new \RuntimeException(sprintf('Generator not found: "%s".', $name));
        }

        return $this->generators[$name];
    }
889995
public function getReferences()
    {

        // build links
        $references = array();

        foreach( $this->getAttributes() as $column ) {

            // A relation has a reference if one of its attributes is referenced by another
            if( $column->isUnique() and ( $refs = $column->getIsReferencedBy() ) ) {

                foreach( $refs as $reference ) {

                    $name = sprintf(
                        "%s.%s",
                        $reference->getRelation()->getEntityName(),
                        $reference->name
                    );

                    $references[$name] = array(
                        $reference->getRelation()->getEntityName(),
                        $reference->name,
                        $reference->isUnique() ? 0 : 1
                    );

                }

            }

        }

        return $references;

    }
878395
public function transform($collection)
    {   
        if (!$collection instanceof Collection) {  
            return null; 
        }
        
        $data = array();
        $accessor = PropertyAccess::createPropertyAccessor();
        
        foreach ($collection as $ref){
            if (!$ref instanceof Select2SortableInterface){
                throw new \InvalidArgumentException('Reference class must be instance of Select2SortableInterface');  
            }
            
            $data[] = $accessor->getValue($ref, $this->inversedProperty)->getId();
        }
        
        $this->collection = $collection;
        
        return implode(',', $data);
    }
133249
public function referencedBy( $entity )
    {

        if( !( $entity instanceof Base || $entity instanceof Container ) ) {
            throw new \InvalidArgumentException("You can only lookup references by Entity or Container");
        }

        $class = $entity instanceof Container
            ? $entity->class
            : $entity;

        $properties = $this->propertiesOfTypeGet( $class );

        // found a entity?
        if( !$properties ) {
            throw new \LogicException(
                sprintf(
                    "Can't find which entity property for repository `%s` references entity of type `%s`",
                    $this->entity,
                    $entityClass
                )
            );
        } elseif( count( $properties ) > 1 ) {
            throw new \LogicException(
                sprintf(
                    "Multiple columns [%s] reference a entity of this type [%s]. This is ambiguous. Can't help you here.",
                    implode( ",", $properties ),
                    \Bond\get_unqualified_class( $entity )
                )
            );
        }

        $property = array_pop( $properties );

        // get references to this entity
        $filterComponent = $this->getFindFilterFactory()
            ->get( $property, null, $entity );

        return $this->findByFilterComponents(
            FindFilterComponentFactory::FIND_ALL,
            array( $property => $filterComponent )
        );

    }
562512
private function getServiceCall($id, Reference $reference = null)
    {
        while ($this->container->hasAlias($id)) {
            $id = (string) $this->container->getAlias($id);
        }
        $id = $this->container->normalizeId($id);

        if ('service_container' === $id) {
            return '$this';
        }

        if ($this->container->hasDefinition($id) && ($definition = $this->container->getDefinition($id)) && !$definition->isSynthetic()) {
            if (null !== $reference && ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $reference->getInvalidBehavior()) {
                $code = 'null';
                if (!$definition->isShared()) {
                    return $code;
                }
            } elseif ($this->isTrivialInstance($definition)) {
                $code = substr($this->addNewInstance($definition, '', '', $id), 8, -2);
                if ($definition->isShared()) {
                    $code = sprintf('$this->services[\'%s\'] = %s', $id, $code);
                }
            } elseif ($this->asFiles && $definition->isShared() && !$this->isHotPath($definition)) {
                $code = sprintf("\$this->load('%s.php')", $this->generateMethodName($id));
            } else {
                $code = sprintf('$this->%s()', $this->generateMethodName($id));
            }
        } elseif (null !== $reference && ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $reference->getInvalidBehavior()) {
            return 'null';
        } elseif (null !== $reference && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $reference->getInvalidBehavior()) {
            $code = sprintf('$this->get(\'%s\', /* ContainerInterface::NULL_ON_INVALID_REFERENCE */ %d)', $id, ContainerInterface::NULL_ON_INVALID_REFERENCE);
        } else {
            $code = sprintf('$this->get(\'%s\')', $id);
        }

        // The following is PHP 5.5 syntax for what could be written as "(\$this->services['$id'] ?? $code)" on PHP>=7.0

        return "\${(\$_ = isset(\$this->services['$id']) ? \$this->services['$id'] : $code) && false ?: '_'}";
    }
811986
public function getGeneratorSettings($generator) {
        return $this->settings->getOptional("generators", $generator, fphp\Generator\Settings::emptyInstance());
    }
46921
private function getReferencesDeclaration()
    {

        // we got a max instances allowed in normality tags
        $references = json_encode( $this->entity->pgClass->getReferences() );
        $references = Php::varExport( $references, true );

        $this->class->classComponents[] = new VariableDeclaration(
            'references',
            new SFormatf( <<<'PHP'
                /**
                 * Reference information for this relation
                 * @var array
                 */
                protected $references = %s;
PHP
                , $references
            )
        );

    }
541690
public static function getCodeGenerator($entityClass, $entityField = 'code')
    {
        if (!isset(self::$generators[$entityClass][$entityField])) {
            throw new \Exception("There is no registered entity code generator for class $entityClass and field $entityField");
        }

        return self::$generators[$entityClass][$entityField];
    }
1157130
public function fetchParametersAsync(): \Generator
    {
        $refetchable = $this->isRefetchable();
        if ($this->fetched && !$refetchable) {
            return $this->params;
        }
        $params = yield call([$this, 'getParameters']);

        if (!$refetchable) {
            $this->params = $params;
        }

        return $params;
    }
771478
public function getPageGenerators()
    {
        if (!is_null($this->_pageGenerators)) return $this->_pageGenerators;

        $cacheId = $this->componentClass . '_pageGenerators';

        $generators = Kwf_Cache_SimpleStatic::fetch($cacheId);
        if (!$generators) {
            $generators = array();
            foreach (Kwc_Abstract::getComponentClasses() as $class) {
                foreach (Kwc_Abstract::getSetting($class, 'generators') as $key => $generator) {
                    if (!isset($generator['class'])) {
                        throw new Kwf_Exception("no generator class set for generator '$key' in component '$class'");
                    }
                    if (is_instance_of($generator['class'], 'Kwc_Root_Category_Generator')) {
                        $generators[] = array('class' => $class, 'key' => $key, 'generator' => $generator);
                    }
                }
            }
            Kwf_Cache_SimpleStatic::add($cacheId, $generators);
        }

        $this->_pageGenerators = array();
        foreach ($generators as $g) {
            $this->_pageGenerators[] = Kwf_Component_Generator_Abstract::getInstance(
                $g['class'], $g['key'], $g['generator']
            );
        }
        return $this->_pageGenerators;
    }
1294328
public function transformEntity($entity, $transformer = null, SerializerAbstract $serializer = null): array
	{
		$transformer = $transformer ?: $this->getTransformerFromClassProperty();

		$results = $this->transform()->resourceWith($entity, $transformer)->usingPaginatorIfPaged();

		if ($serializer) {
			return $results->serialize($serializer);
		}

		return $results->serialize();
	}
935814
public function retrieveCustomerByExternalReference($reference)
  {
    $ep = $this->_getEndpoint();
    $payload = new PaginatedDataNodePayload();
    $payload->filter = [
      AdvancedFilterPayload::create(
        'externalReference',
        AdvancedFilterComparator::EQUAL,
        $reference
      ),
    ];
    $customers = $this->_processRequest($ep->all($payload));
    if(count($customers->items) >= 1)
    {
      return Arrays::first($customers->items);
    }
    else
    {
      throw new NotFoundException(
        "No customer could be located with the reference $reference"
      );
    }
  }
104230
protected function getEntityGenerator($classToExtend = null)
    {
        $entityGenerator = new EntityGenerator();
        if (!is_null($classToExtend)) {
            $entityGenerator->setClassToExtend($classToExtend);
        }
        $entityGenerator->setGenerateAnnotations(true);
        $entityGenerator->setGenerateStubMethods(true);
        $entityGenerator->setRegenerateEntityIfExists(false);
        $entityGenerator->setUpdateEntityIfExists(true);
        $entityGenerator->setNumSpaces(4);
        $entityGenerator->setAnnotationPrefix('ORM\\');

        return $entityGenerator;
    }
1298765
private function getDataReference($item) {
    if ($this->isASleepingReference) {
      $this->referenceWake();
    }
    if ((is_a($item, '\Nymph\Entity') || is_a($item, '\SciActive\HookOverride'))
        && is_callable([$item, 'toReference'])) {
      // Convert entities to references.
      return $item->toReference();
    } elseif (is_array($item)) {
      // Recurse into lower arrays.
      return array_map([$this, 'getDataReference'], $item);
    } elseif (is_object($item)) {
      foreach ($item as &$curProperty) {
        $curProperty = $this->getDataReference($curProperty);
      }
      unset($curProperty);
    }
    // Not an entity or array, just return it.
    return $item;
  }