public function getClassMigrationMethods($className)
    {
        if (isset($this->classMigrationMethods[$className])) {
            return $this->classMigrationMethods[$className];
        }

        $migrationAnnotations = $this->getClassMigrationMethodInfo($className);

        $migrationMethods = new MigrationMethods();

        foreach ($migrationAnnotations as $migrationAnnotation) {
            $method = $migrationAnnotation->method;
            $migrationAnnotation = $migrationAnnotation->annotation;

            if (null !== $migrationAnnotation->from) {
                if (false === $method->isStatic() || 2 !== $method->getNumberOfParameters()) {
                    throw new \LogicException(
                        'Method "' . $method->getName(
                        ) . '" in "' . $className . '" should be static and require 2 parameters.'
                    );
                }

                if ($migrationAnnotation->from === $className) {
                    throw new \LogicException(
                        'Method "' . $method->getName(
                        ) . '" in "' . $className . '" should have a migration from a different class.'
                    );
                }

                $otherClass = $migrationAnnotation->from;
                $otherClassVersion = $this->getClassVersion($otherClass);
                $migrationMethods->from[$otherClassVersion] = new CreateAction($method);

            } elseif (null !== $migrationAnnotation->to) {
                if (true === $method->isStatic() || 1 !== $method->getNumberOfParameters()) {
                    throw new \LogicException(
                        'Method "' . $method->getName(
                        ) . '" in "' . $className . '" should not be static and require 1 parameter.'
                    );
                }

                if ($migrationAnnotation->to === $className) {
                    throw new \LogicException(
                        'Method "' . $method->getName(
                        ) . '" in "' . $className . '" should have a migration to a different class.'
                    );
                }

                $otherClass = $migrationAnnotation->to;
                $otherClassVersion = $this->getClassVersion($otherClass);
                $migrationMethods->to[$otherClassVersion] = new CloneAction($method);

            }
        }

        $this->classMigrationMethods[$className] = $migrationMethods;

        return $migrationMethods;
    }
public function getClassMigrationMethods($className)
    {
        if (isset($this->classMigrationMethods[$className])) {
            return $this->classMigrationMethods[$className];
        }

        $migrationAnnotations = $this->getClassMigrationMethodInfo($className);

        $migrationMethods = new MigrationMethods();

        foreach ($migrationAnnotations as $migrationAnnotation) {
            $method = $migrationAnnotation->method;
            $migrationAnnotation = $migrationAnnotation->annotation;

            if (null !== $migrationAnnotation->from) {
                if (false === $method->isStatic() || 2 !== $method->getNumberOfParameters()) {
                    throw new \LogicException(
                        'Method "' . $method->getName(
                        ) . '" in "' . $className . '" should be static and require 2 parameters.'
                    );
                }

                if ($migrationAnnotation->from === $className) {
                    throw new \LogicException(
                        'Method "' . $method->getName(
                        ) . '" in "' . $className . '" should have a migration from a different class.'
                    );
                }

                $otherClass = $migrationAnnotation->from;
                $otherClassVersion = $this->getClassVersion($otherClass);
                $migrationMethods->from[$otherClassVersion] = new CreateAction($method);

            } elseif (null !== $migrationAnnotation->to) {
                if (true === $method->isStatic() || 1 !== $method->getNumberOfParameters()) {
                    throw new \LogicException(
                        'Method "' . $method->getName(
                        ) . '" in "' . $className . '" should not be static and require 1 parameter.'
                    );
                }

                if ($migrationAnnotation->to === $className) {
                    throw new \LogicException(
                        'Method "' . $method->getName(
                        ) . '" in "' . $className . '" should have a migration to a different class.'
                    );
                }

                $otherClass = $migrationAnnotation->to;
                $otherClassVersion = $this->getClassVersion($otherClass);
                $migrationMethods->to[$otherClassVersion] = new CloneAction($method);

            }
        }

        $this->classMigrationMethods[$className] = $migrationMethods;

        return $migrationMethods;
    }
public function getClassMigrationMethods ( $ className ) { if ( isset ( $ this -> classMigrationMethods [ $ className ] ) ) { return $ this -> classMigrationMethods [ $ className ] ; } $ migrationAnnotations = $ this -> getClassMigrationMethodInfo ( $ className ) ; $ migrationMethods = new MigrationMethods ( ) ; foreach ( $ migrationAnnotations as $ migrationAnnotation ) { $ method = $ migrationAnnotation -> method ; $ migrationAnnotation = $ migrationAnnotation -> annotation ; if ( null !== $ migrationAnnotation -> from ) { if ( false === $ method -> isStatic ( ) || 2 !== $ method -> getNumberOfParameters ( ) ) { throw new \ LogicException ( 'Method "' . $ method -> getName ( ) . '" in "' . $ className . '" should be static and require 2 parameters.' ) ; } if ( $ migrationAnnotation -> from === $ className ) { throw new \ LogicException ( 'Method "' . $ method -> getName ( ) . '" in "' . $ className . '" should have a migration from a different class.' ) ; } $ otherClass = $ migrationAnnotation -> from ; $ otherClassVersion = $ this -> getClassVersion ( $ otherClass ) ; $ migrationMethods -> from [ $ otherClassVersion ] = new CreateAction ( $ method ) ; } elseif ( null !== $ migrationAnnotation -> to ) { if ( true === $ method -> isStatic ( ) || 1 !== $ method -> getNumberOfParameters ( ) ) { throw new \ LogicException ( 'Method "' . $ method -> getName ( ) . '" in "' . $ className . '" should not be static and require 1 parameter.' ) ; } if ( $ migrationAnnotation -> to === $ className ) { throw new \ LogicException ( 'Method "' . $ method -> getName ( ) . '" in "' . $ className . '" should have a migration to a different class.' ) ; } $ otherClass = $ migrationAnnotation -> to ; $ otherClassVersion = $ this -> getClassVersion ( $ otherClass ) ; $ migrationMethods -> to [ $ otherClassVersion ] = new CloneAction ( $ method ) ; } } $ this -> classMigrationMethods [ $ className ] = $ migrationMethods ; return $ migrationMethods ; }
Get migrations for a class.

@param string $className

@return MigrationMethods

@throws \LogicException
Get migrations for a class .