Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Crm Task Bundle Laravel Package

oro/crm-task-bundle

Adds Task activity support to Oro applications, with UI to create and manage tasks, a default task workflow, grid listings for personal and system-wide tasks, and calendar integration to view tasks by date and link them to related records.

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Steps

  1. Installation Add the bundle via Composer in a Laravel project using Doctrine ORM:

    composer require oro/crm-task-bundle
    

    Ensure your Laravel app supports Symfony’s DependencyInjection and HttpKernel (e.g., via symfony/http-kernel and symfony/dependency-injection).

  2. Database Setup Run Oro’s migrations for the Task entity:

    php bin/console doctrine:migrations:execute --query="SELECT * FROM migration_version WHERE version = 'Oro\Bundle\TaskBundle\Migrations\Schema\vX_Y_Z'"
    

    Note: If using Laravel’s migrations, manually adapt Oro’s SQL or use doctrine/dbal to execute raw SQL.

  3. First Use Case Create a task via the CLI or a Laravel controller:

    use Oro\Bundle\TaskBundle\Entity\Task;
    use Oro\Bundle\TaskBundle\Manager\TaskManager;
    
    $taskManager = app(TaskManager::class);
    $task = new Task();
    $task->setTitle('Follow up with client');
    $task->setDescription('Call John Doe on 2023-12-31');
    $task->setDueDate(new \DateTime('2023-12-31'));
    $taskManager->save($task);
    
  4. Basic Routing Expose a REST endpoint in routes/web.php:

    use Oro\Bundle\TaskBundle\Controller\TaskController;
    
    Route::get('/tasks', [TaskController::class, 'index']);
    

    Note: Oro’s controllers assume Symfony’s routing. Override or adapt to Laravel’s router.


Implementation Patterns

Usage Patterns

  1. Task Creation and Management

    • Use TaskManager to create/update tasks:
      $taskManager = app(TaskManager::class);
      $task = $taskManager->find(1); // Fetch by ID
      $taskManager->save($task);     // Update
      
    • Assign tasks to users:
      $task->setAssignee($userEntity);
      
  2. Workflow Integration

    • Trigger workflow transitions (e.g., "Start" or "Complete"):
      use Oro\Bundle\WorkflowBundle\Provider\WorkflowProvider;
      
      $workflowProvider = app(WorkflowProvider::class);
      $workflow = $workflowProvider->getWorkflow('task_workflow');
      $workflow->apply($task, 'complete');
      
    • Laravel Adaptation: Replace Symfony’s EventDispatcher with Laravel’s events:
      event(new TaskCompleted($task));
      
  3. Calendar Integration

    • Link tasks to Oro’s CalendarBundle:
      $task->setCalendarEvent($calendarEventEntity);
      
    • Laravel Workaround: Use Laravel’s spatie/calendar or laravel-calendar to sync with Oro’s events via API.
  4. DataGrid Customization

    • Extend Oro’s TaskDatagrid in Laravel:
      use Oro\Bundle\TaskBundle\Datagrid\TaskDatagrid;
      use Oro\Bundle\DataGridBundle\Extension\Datagrid\DatagridExtension;
      
      $datagrid = new TaskDatagrid();
      $datagrid->add('custom_column', 'entity.customField');
      
    • Frontend: Render the grid in Blade using JSON responses or a custom Laravel package like voyager.
  5. API Exposure

    • Expose tasks via Laravel’s API:
      Route::apiResource('tasks', \App\Http\Controllers\TaskApiController::class);
      
      // TaskApiController.php
      public function index(TaskManager $taskManager) {
          return response()->json($taskManager->getAll());
      }
      

Workflows

  1. Task Assignment Workflow

    • Step 1: Create a task tied to a lead/contact (e.g., in OroCRM).
    • Step 2: Assign the task to a user via TaskManager.
    • Step 3: Notify the assignee using Laravel’s notifications:
      $task->getAssignee()->notify(new TaskAssigned($task));
      
  2. Automated Task Creation

    • Use Laravel’s observers or events to create tasks:
      // app/Observers/LeadObserver.php
      public function created(Lead $lead) {
          $task = new Task();
          $task->setTitle("Follow up on lead {$lead->id}");
          $taskManager->save($task);
      }
      
  3. Calendar Sync

    • Sync tasks with Google Calendar (via spatie/laravel-google-calendar) or a custom calendar:
      $calendarEvent = new \Oro\Bundle\CalendarBundle\Entity\CalendarEvent();
      $calendarEvent->setTitle($task->getTitle());
      $calendarEvent->setStartDate($task->getDueDate());
      $calendarManager->save($calendarEvent);
      $task->setCalendarEvent($calendarEvent);
      $taskManager->save($task);
      

Integration Tips

  1. Laravel-ify Oro Services

    • Bind Oro services to Laravel’s container in AppServiceProvider:
      public function register() {
          $this->app->bind(
              \Oro\Bundle\TaskBundle\Manager\TaskManager::class,
              \Oro\Bundle\TaskBundle\Manager\TaskManager::class
          );
      }
      
  2. Doctrine Configuration

    • Configure Doctrine in config/doctrine.php:
      return [
          'orm' => [
              'entity_managers' => [
                  'default' => [
                      'mappings' => [
                          'OroTaskBundle' => [
                              'type' => 'xml',
                              'path' => 'vendor/oro/task-bundle/Resources/config/doctrine',
                          ],
                      ],
                  ],
              ],
          ],
      ];
      
  3. Frontend Adaptation

    • Replace Twig templates with Blade by creating a custom view resolver or using laravel-blade-twig.
    • For Oro’s JavaScript bundles, include them in Laravel Mix:
      // resources/js/app.js
      import 'oro-task-bundle/js/app';
      
  4. Event Handling

    • Subscribe to Oro’s events using Laravel’s listeners:
      // app/Listeners/TaskListener.php
      public function handle(TaskCreatedEvent $event) {
          Log::info("Task created: {$event->getTask()->getTitle()}");
      }
      
      Register the listener in EventServiceProvider:
      protected $listen = [
          \Oro\Bundle\TaskBundle\Event\TaskEvents::TASK_CREATED => [
              \App\Listeners\TaskListener::class,
          ],
      ];
      

Gotchas and Tips

Pitfalls

  1. Symfony vs. Laravel DI

    • Issue: Oro’s services assume Symfony’s ContainerInterface. Laravel’s Container may throw errors for missing methods (e.g., getParameterBag()).
    • Fix: Create a wrapper or use symfony/dependency-injection to bridge the gap:
      $container = new \Symfony\Component\DependencyInjection\Container();
      $container->set('oro_task.manager.task', $taskManager);
      
  2. Database Conflicts

    • Issue: Oro’s migrations may conflict with Laravel’s schema. For example, task table columns might differ.
    • Fix: Use doctrine/dbal to manually run Oro’s SQL or adapt migrations:
      php bin/console doctrine:schema:update --force
      
      Tip: Backup your database before running Oro migrations.
  3. Routing Conflicts

    • Issue: Oro’s routes (e.g., /task) may clash with Laravel’s routes.
    • Fix: Override Oro’s routes in routes/web.php:
      Route::prefix('oro')->group(function () {
          require __DIR__.'/oro.php'; // Include Oro’s routes
      });
      
  4. Twig Dependencies

    • Issue: Oro’s templates require Twig. Laravel’s Blade won’t render them natively.
    • Fix: Use laravel-blade-twig or rewrite templates in Blade:
      composer require darkaonline/laravel-blade-twig
      
  5. Workflow Engine

    • Issue: Oro’s WorkflowBundle is tightly coupled to Symfony’s event system. Laravel’s events won’t trigger Oro workflows by default.
    • Fix: Create a Laravel event listener that manually triggers Oro workflows:
      public function handle(TaskCreated $event) {
          $workflow = app(\Oro\Bundle\WorkflowBundle\Provider\WorkflowProvider::class)
              ->getWorkflow('task_workflow');
          $workflow->apply($event->task, 'start');
      }
      
  6. Entity Class Names

    • **Issue
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle