public function optimisticLocking(IOptimisticLockingStrategy $strategy)
    {
        foreach ($strategy->getLockingColumnNames() as $columnName) {
            if (!isset($this->columns[$columnName])) {
                throw InvalidArgumentException::format(
                    'Cannot add optimistic locking strategy: expecting one of columns (%s), \'%s\' given',
                    Debug::formatValues(array_keys($this->columns)), $columnName
                );
            }
        }

        $this->lockingStrategies[] = $strategy;
    }
public function optimisticLocking(IOptimisticLockingStrategy $strategy)
    {
        foreach ($strategy->getLockingColumnNames() as $columnName) {
            if (!isset($this->columns[$columnName])) {
                throw InvalidArgumentException::format(
                    'Cannot add optimistic locking strategy: expecting one of columns (%s), \'%s\' given',
                    Debug::formatValues(array_keys($this->columns)), $columnName
                );
            }
        }

        $this->lockingStrategies[] = $strategy;
    }
public function optimisticLocking ( IOptimisticLockingStrategy $ strategy ) { foreach ( $ strategy -> getLockingColumnNames ( ) as $ columnName ) { if ( ! isset ( $ this -> columns [ $ columnName ] ) ) { throw InvalidArgumentException :: format ( 'Cannot add optimistic locking strategy: expecting one of columns (%s), \'%s\' given' , Debug :: formatValues ( array_keys ( $ this -> columns ) ) , $ columnName ) ; } } $ this -> lockingStrategies [ ] = $ strategy ; }
Adds an optimistic locking strategy to use during persistence.

@param IOptimisticLockingStrategy $strategy

@return void
@throws InvalidArgumentException
Adds an optimistic locking strategy to use during persistence .