Пример #1
0
 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();
 }
Пример #2
0
 /**
  * Standard constructor
  */
 public function __construct(Options $options, EntityManager $entityManager = null, array $callbacks = array())
 {
     $options->checkPaths();
     $this->options = $options;
     $this->entityManager = $entityManager;
     $this->callbacks = new Flock('is_callable');
     $this->callbacks['log'] = function () {
     };
     $this->callbacks->merge($callbacks);
     $this->processed = new Container();
     $this->matches = new Flock('Bond\\Normality\\MatchRelationInterface');
     $this->profiler = new Profiler("Normality Entity generation");
     $this->profiler->log("Init");
 }
Пример #3
0
 /**
  * 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;
 }