public function operation($operation)
    {
        $existing = $this->operations->findByIdentifier($operation);

        if ($existing) {
            return $existing;
        }

        $scaffoldClass = OperationScaffolder::getClassFromIdentifier($operation);
        if (!$scaffoldClass) {
            throw new InvalidArgumentException(
                sprintf(
                    'Invalid operation: %s added to %s',
                    $operation,
                    $this->getDataObjectClass()
                )
            );
        }
        /**
         * @var OperationScaffolder $scaffolder
         */
        $scaffolder = Injector::inst()->createWithArgs($scaffoldClass, [$this->getDataObjectClass()]);

        $this->operations->push(
            $scaffolder->setChainableParent($this)
        );

        return $scaffolder;
    }
public function operation($operation)
    {
        $existing = $this->operations->findByIdentifier($operation);

        if ($existing) {
            return $existing;
        }

        $scaffoldClass = OperationScaffolder::getClassFromIdentifier($operation);
        if (!$scaffoldClass) {
            throw new InvalidArgumentException(
                sprintf(
                    'Invalid operation: %s added to %s',
                    $operation,
                    $this->getDataObjectClass()
                )
            );
        }
        /**
         * @var OperationScaffolder $scaffolder
         */
        $scaffolder = Injector::inst()->createWithArgs($scaffoldClass, [$this->getDataObjectClass()]);

        $this->operations->push(
            $scaffolder->setChainableParent($this)
        );

        return $scaffolder;
    }
public function operation ( $ operation ) { $ existing = $ this -> operations -> findByIdentifier ( $ operation ) ; if ( $ existing ) { return $ existing ; } $ scaffoldClass = OperationScaffolder :: getClassFromIdentifier ( $ operation ) ; if ( ! $ scaffoldClass ) { throw new InvalidArgumentException ( sprintf ( 'Invalid operation: %s added to %s' , $ operation , $ this -> getDataObjectClass ( ) ) ) ; } /**
         * @var OperationScaffolder $scaffolder
         */ $ scaffolder = Injector :: inst ( ) -> createWithArgs ( $ scaffoldClass , [ $ this -> getDataObjectClass ( ) ] ) ; $ this -> operations -> push ( $ scaffolder -> setChainableParent ( $ this ) ) ; return $ scaffolder ; }
Find or make an operation.

@param string $operation

@return OperationScaffolder
Find or make an operation .