Giter Club home page Giter Club logo

lexikworkflowbundle's People

Contributors

adirelle avatar delasallejean avatar gilles-g avatar jeremyb avatar jeremyfreeagent avatar kix avatar maarekj avatar stephpy avatar wcluijt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lexikworkflowbundle's Issues

laravel integration

I'm seeking for such a package for laravel , can anyone help me with this?

Where to start process

This is more of a support query. Once I've fully understood this bundle, I would love to contribute with a pull request to the README file.

The line $processHandler->start($model); from your Usage example needs to be called once an entity is persisted for the first time. I hence thought I'd use an entity listener or lifecycle subscriber to handle it, but am getting a circular reference. Alternatively, I could implement checks in my form handler to call the method when the entity is first persisted.

What do you guys do in your projects โ€“ where do you call it?

about app/config/config.yml

I have this error:
Invalid configuration for path "lexik_workflow.processes.post_publication.steps.draft_created.model_status": You must specify a valid constant name as second parameter

Can somebody help me with this???
thanks!!!

public reachStep

Hi,
I started using your bundle this week and I got some troubles using it.

There is two things I would like to know :

  • is there any way to reach any step in a proccess, by-passing the flow ? (i.e. I am admin, I would like to reach the Step 2 from Step 4 because of an issue during the Step 3)
  • is there any way to start the flow from anywhere ? i've got some fixtures to test some behaviours with behat, and a php script to create tons of objects. I would like to launch ProgressHandler::start($object) from the script/fixtures but I've got some security context issues.

Model state expiration?

Is it possible to define an expiration date for a certain object state? To keep with the example of the documentation, let's assume I wish to delete all Post objects whose model state have been Post::STATUS_DRAFT for more than 30 days.

I could easily do this manually by calling a Symfony2 console command from a daily cronjob. But how would I properly do this within the workflow framework?

Use Security Voters instead of roles

Having a roles attribute is an easy way to check permissions, but has some limitations. What if you want to allow users to edit their own posts/comments/whatever?

I think the Security Voters are the perfect way to check if a user has permissions to change the state of an object.

What about adding Security Voters to this bundle?

The given model has already started the "post_publication" process

hello !

My error comes from my controller ($modelSate =$processHandler->start($model);).

I looked in the processHandler to identify the error but I don't know of or comes this error,

Thank you in advance for your help and I will be happy to resolve the error with you.

Check whether it is possible to reach a step (canReachNextStep)

Hi,
when trying to use LexikWorkflowBundle for our project the need arose to be able to check whether a process can reach a next step without actually advancing the model to the next step. In more practical terms, I would like to know whether a user of my system is able to submit a certain web form before actually showing the form to the user. So I probably need something along the lines of:

if ($processHandler->canReachNextState($model, 'validate')) {...}

Like this we avoid duplicating code in the workflow validators and form controllers.

Is there a function like this? I didn't find one.

If there is not, I would probably simply copy $processHandler::reachNextState() and adapt the method to my needs. This rises the next question:

What is the best way to extend the ProcessHandler?

Cheers,
Andreas

Defining a conditional step

Hi, I have an issue defining a conditional step in my workflow.
After my request has been validated by HR department, I'd like to check if the request needs to be validated by a director with a conditional step and if so, go to the step named "validation_director". If the request doesn't need to be validated by a director, just end the process.

My conditional step is defined as below :

lexik_workflow:
    processes:
        clearance_request:
            start:  clearance_request_created
            steps:
                ....
                validated_by_HR:
                    label:      "Request validated by Human Resources"
                    model_status:   [ setStatus, AppBundle\Entity\Request::STATUS_VALIDATED_HR ]
                    next_states:
                        check_direct_validation:
                            type: step_or
                            target:
                                validation_director: "resource:needDirectorValidation"
               .......

I have then, an error when displaying any page :

InvalidTypeException: Invalid type for path "lexik_workflow.processes.clearance_request.steps.validated_by_HR.next_states.check_director_validation.target". Expected scalar, but got array.

Any idea of what's wrong with my workflow definition ?

Thank you :)

Fully functional demo

Can I perhaps get a functional demo of this workflow bundle somewhere? I understand how it it works but I don't understand how will a user with Admin roles see the post that require approval, and how does te Admin approve it then.

Can someone please help with a sample application where I can look how it works?

Understanding the workflow

Hi,

I have gone through the Workflow example as it states but find it a little difficult to understand some sections. Would you be able to guide me through the following?

  1. Are 'roles' defined in each step necessary or is it an additional step? (Are these attributes defined in the library?)
  2. In 'model_status' attribute, for an example, 'Project\Bundle\SuperBundle\Entity\Post::STATUS_VALIDATED' where can i find this template entity in the given example? Is this like an object to store the statuses?
  3. Along with these defined steps and processes, how would i show the UI? E.g. In 'draft_created' step i want to show a UI and in 'validated_by_admin' step i want to show another. Likewise i would need to show different UIs for each step. Is this possible?
  4. Where does this part go to 'service id=project.workflow.listener.post_publication /service'

Thank you in advance.

Progress History Log in this workflow bundle

Is it possible that this bundle can keep track of the progress of a work flow?

What I mean; is it possible to save each action in a database table? Like John Doe created the first draft on yyyy/mm/dd. When someone approve it, another row gets added; Admin Jack approved draft on yyyy/mm/dd...

I am going to implement this work flow bundle, and I need to log all user actions as well, so I wonder if it can be accomplished with this or should I look for another bundle or develop that myself?

Thank you

Question about Model & add/get States

I have made a model for my entity which implements ModelInterface and ModelStateInterface

My model :

<?php
namespace myProject\myBundle\WorkFlow\Model;

use Lexik\Bundle\WorkflowBundle\Model\ModelInterface;
use Lexik\Bundle\WorkflowBundle\Model\ModelStateInterface;
use Lexik\Bundle\WorkflowBundle\Entity\ModelState;
use myProject\myBundle\Entity\myEntity;

class myModel implements ModelInterface, ModelStateInterface
{ 
    ... 
    public function addState(ModelState $modelState)
    {
        $this->myEntity->setStates[] = $modelState;
    }

    public function getStates()
    {
        return $this->myEntity->getStates;
    }
}

Entity side added parameter (getter and setters by doctrine) :

    /**
     * @ORM\Column(nullable=true, name="States", type="array")
     */
    protected $states = array(); 

    /**
     * @ORM\Column(nullable=true, name="Status", type="smallint")
     */
    private $Status;

In my controller i do :

$em = $this->getDoctrine()->getManager();
$em->getConnection()->beginTransaction();
try {
    // persist 1st my entity to get the entity id
    $em->persist($myEntity);
    $em->flush();

    // next create modelstate and update status in my entity
    $myEntityModel = new MyModel($myEntity);
    $processHandler = $this->get('lexik_workflow.handler.myprocess');
    $ModelState = $processHandler->start($myEntityModel)
    $em->flush();
    $em->getConnection()->commit();

} catch (WorkflowException $e) {
    $em->getConnection()->rollback();
    $em->close();
}
  1. I have to implement addStates and getStates into the model or directly into the entity ?

  2. Is it the best way in my controller to try / catch and reverse if WorkFlowException ?

  3. My entity is ALWAYS saved in DB with States => empty array, why ?

    // This code doesn't work :(
    $myEntityModel->addState($ModelState)
  1. Why there is an objects option into getStates, we have to do it from the entity model, no ?

Sorry for my bad english !

No documentation about ModelInterface::getWorkflowObject

Hi,

I just (rather accidentally) updated bundle today and stumbled upon new method to implement from ModelInterface - getWorkflowObject.
Its not documented right now (or i simply couldnt find it), so am I right to assume that getWorkflowObject simply returns my domain object?

Problem when wiring up service

Hi,
I tried to create a workflow inside a bundle but when I try to define the service for ProcessSuscriber, the only definition of the name tag (- { name: kernel.event_listener }) in services.yml file generates an error. It seems I must define at least the event attribute and the method that will be called when event is fired.

Error is :

InvalidArgumentException: Service "mybunlde.workflow.listener.myWorkflowName" must define the "event" attribute on "kernel.event_listener" tags.

Am I missing something ?

Poor documentation

It's such a shame for such poor documentation for a bundle that have so much potential...

Subscribed event to send mail not working

I have implemented 02 routes from draft creation to admin validation steps. Now I want to add a event subscriber so that after draft creation is reached, an email will trigger.

I am adding the event to subscribedEvents as:

public static function getSubscribedEvents()
    {
        return array(
            'post_publication.draft_created.reached' => array(
                'handleDraftCreated',
            ),
        );
    }

But unfortunately the handleDraftCreated function never called:

public function handleDraftCreated(StepEvent $event)
    {
        echo "handleDraftCreated called";
    }

Anything I am missing here, need help, thanks in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.