Lock in $30 Savings on PRO—Offer Ends Soon! ⏳

Logika biznesowa w aplikacjach web - Symfony wo...

Avatar for Dominik Dominik
March 16, 2017

Logika biznesowa w aplikacjach web - Symfony workflow

Business application management using Symfony Workflow
Slides from phpers Rzeszów http://phpers.pl

Avatar for Dominik

Dominik

March 16, 2017
Tweet

Other Decks in Programming

Transcript

  1. $status = $a->getStatus(); if(is_array($status)){ $this->doSth(); } if($status > 3 &&

    $a->deleted() == false){ $this->doOther(); } if($status > 5 || $status != false) { $this->wtf_this_status_is(); //?!? }
  2. // set status 2 to mark as deleted // http://documentation.com?id=986875

    $status = 1; // not sure why but for 2 not works // link to doc not working!!!
  3. /** * set tutorial * * rules: * 1. start

    only for not UK users * 2. publishers only * 3. just if active tutorial * 4. set only if not finished already * ... * 99. display also if forced !! */ public function tutorialAction() { }
  4. /** * When I wrote this, only God and *

    I understood what I was doing * * Now, God only knows * * * Magic. Do not touch. */ function parse_magic($sth, $sth2) {
  5. MASZYNA STANU Nie może być w więcej niż jednym miejscu

    w tym samym momencie Może mieć ścieżki cykliczne
  6. WORKFLOW Może być w więcej niż jednym miejscu w tym

    samym momencie Zwykle nie ma ścieżek cyklicznych
  7. $builder = new DefinitionBuilder(); $builder->addPlaces( [ 'initial', 'booked', 'payed', 'done',

    ] ); $builder->addTransition( new Transition( 'pay', 'booked', 'payed' ) ); $builder->addTransition ...
  8. $booking = new Booking(); $workflow = $registry->get($booking); // False $workflow->can($booking,

    'pay'); // True $workflow->can($booking, 'book'); $workflow->apply($booking, 'book'); $workflow->can($booking, 'pay');
  9. try { $workflow->apply( $post, 'to_review' ); } catch (LogicException $e)

    { // ... } $transitions = $workflow ->getEnabledTransitions($post);
  10. <h3>Twig cd..</h3> {% for transition in workflow_transitions(post) %} <a href="...">{{

    transition.name }}</ {% else %} No actions available. {% endfor %}
  11. 1. POBRANIE OBIEKTU (STANU) 2. SPRAWDZENIE CZY TRANZYCJA MOŻLIWA 3.

    AKCJA NA OBIEKCIE (SERWIS) 4. WYKONANIE TRANZYCJI