public function process(LazaretSession $session, File $file, $callable = null, $forceBehavior = null, $nosubdef = false)
    {
        $visa = $this->getVisa($file);

        // Generate UUID
        $file->getUUID(true, false);

        if (($visa->isValid() || $forceBehavior === self::FORCE_RECORD) && $forceBehavior !== self::FORCE_LAZARET) {

            $this->addMediaAttributes($file);

            $element = $this->createRecord($file, $nosubdef);

            $code = self::RECORD_CREATED;
        } else {

            $element = $this->createLazaret($file, $visa, $session, $forceBehavior === self::FORCE_LAZARET);

            $code = self::LAZARET_CREATED;
        }

        // Write UUID
        $file->getUUID(false, true);

        if (is_callable($callable)) {
            $callable($element, $visa, $code);
        }

        return $code;
    }
public function process(LazaretSession $session, File $file, $callable = null, $forceBehavior = null, $nosubdef = false)
    {
        $visa = $this->getVisa($file);

        // Generate UUID
        $file->getUUID(true, false);

        if (($visa->isValid() || $forceBehavior === self::FORCE_RECORD) && $forceBehavior !== self::FORCE_LAZARET) {

            $this->addMediaAttributes($file);

            $element = $this->createRecord($file, $nosubdef);

            $code = self::RECORD_CREATED;
        } else {

            $element = $this->createLazaret($file, $visa, $session, $forceBehavior === self::FORCE_LAZARET);

            $code = self::LAZARET_CREATED;
        }

        // Write UUID
        $file->getUUID(false, true);

        if (is_callable($callable)) {
            $callable($element, $visa, $code);
        }

        return $code;
    }
public function process ( LazaretSession $ session , File $ file , $ callable = null , $ forceBehavior = null , $ nosubdef = false ) { $ visa = $ this -> getVisa ( $ file ) ; // Generate UUID $ file -> getUUID ( true , false ) ; if ( ( $ visa -> isValid ( ) || $ forceBehavior === self :: FORCE_RECORD ) && $ forceBehavior !== self :: FORCE_LAZARET ) { $ this -> addMediaAttributes ( $ file ) ; $ element = $ this -> createRecord ( $ file , $ nosubdef ) ; $ code = self :: RECORD_CREATED ; } else { $ element = $ this -> createLazaret ( $ file , $ visa , $ session , $ forceBehavior === self :: FORCE_LAZARET ) ; $ code = self :: LAZARET_CREATED ; } // Write UUID $ file -> getUUID ( false , true ) ; if ( is_callable ( $ callable ) ) { $ callable ( $ element , $ visa , $ code ) ; } return $ code ; }
Add a file to Phraseanet after having checked it

@param  LazaretSession $session       The current Lazaret Session
@param  File           $file          A File package object
@param  callable       $callable      A callback to execute after process
(arguments are $element (LazaretFile or \record_adapter),
$visa (Visa)
and $code (self::RECORD_CREATED or self::LAZARET_CREATED))
@param  bool           $forceBehavior Force a behavior, one of the self::FORCE_* constant
@return int            One of the self::RECORD_CREATED or self::LAZARET_CREATED constants
Add a file to Phraseanet after having checked it