public function testRelationNameToOid() { $catalog = new Catalog($this->entityManager->db); $options = new Options($catalog, __DIR__ . '/../../../'); $options->setPath(array('entity' => '/Bond/Normality/UnitTest/Entity/Normality', 'entityPlaceholder' => '/Bond/Normality/UnitTest/Entity', 'repository' => '/Bond/Normality/UnitTest/Repository/Normality', 'repositoryPlaceholder' => '/Bond/Normality/UnitTest/Repository', 'register' => '/Bond/Normality/UnitTest/Entity/Register', 'log' => '/Bond/Normality/UnitTest/Logs', 'backup' => '/Bond/Normality/UnitTest/Backups', 'entityFileStore' => '/Bond/Normality/UnitTest/EntityFileStore')); $options->prepareOptions = Options::BACKUP; $options->matches[] = new Closure(function ($relation) { // return $relation->name === 'a1_child'; return in_array($relation->schema, ['unit', 'logs', 'common']); }); $normality = new Normality($options); $built = $normality->build(); }
/** * Build the entities and repositories */ public static function setupBeforeClass() { $container = parent::setupBeforeClass(); if (self::$normalityProvided) { return $container; } self::$normalityProvided = true; if (!$container) { $container = static::getContainerFromAnnotations()->getcontainer(); } // normality build $catalog = new Catalog($container->get('dbRw')); $options = new Options($catalog, __DIR__ . '/../../../'); $options->setPath(array('entity' => '/Bond/Normality/UnitTest/Entity/Normality', 'entityPlaceholder' => '/Bond/Normality/UnitTest/Entity', 'repository' => '/Bond/Normality/UnitTest/Repository/Normality', 'repositoryPlaceholder' => '/Bond/Normality/UnitTest/Repository', 'register' => '/Bond/Normality/UnitTest/Register', 'log' => '/Bond/Normality/UnitTest/Logs', 'backup' => '/Bond/Normality/UnitTest/Backups', 'entityFileStore' => '/Bond/Normality/UnitTest/EntityFileStore')); $options->prepareOptions = Options::BACKUP; $options->regenerateEntityPlaceholders = true; $options->regenerateRepositoryPlaceholders = true; $options->matches[] = new Closure(function ($relation) { return in_array($relation->schema, ['unit', 'logs', 'common']); }); $normality = new Normality($options); $built = $normality->build(); return $container; }