FactoryGirl\Provider\Doctrine\FixtureFactory::defineEntity PHP Method

defineEntity() public method

See the readme for a tutorial.
public defineEntity ( $name, array $fieldDefs = [], array $config = [] ) : FixtureFactory
$fieldDefs array
$config array
return FixtureFactory
    public function defineEntity($name, array $fieldDefs = array(), array $config = array())
    {
        if (isset($this->entityDefs[$name])) {
            throw new Exception("Entity '{$name}' already defined in fixture factory");
        }
        $type = $this->addNamespace($name);
        if (!class_exists($type, true)) {
            throw new Exception("Not a class: {$type}");
        }
        $metadata = $this->em->getClassMetadata($type);
        if (!isset($metadata)) {
            throw new Exception("Unknown entity type: {$type}");
        }
        $this->entityDefs[$name] = new EntityDef($this->em, $name, $type, $fieldDefs, $config);
        return $this;
    }