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

Akeneo3 0 Tessa Connector Laravel Package

eikona-media/akeneo3-0-tessa-connector

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Steps to Begin

  1. Verify Akeneo API Readiness

    • Ensure Akeneo's API is functional (test via GET /api/rest/v1/associations).
    • Resolve Apache misconfigurations if headers are stripped (see Akeneo API Troubleshooting).
  2. Install the Bundle

    composer require eikona-media/akeneo3-0-tessa-connector
    
  3. Register Routing Append to app/config/routing.yml:

    tessa_media:
        resource: "@EikonaTessaConnectorBundle/Resources/config/routing.yml"
    
  4. Configure TESSA Connection

    • Set TESSA API credentials in app/config/parameters.yml:
      tessa.connector.client_id: "your_client_id"
      tessa.connector.client_secret: "your_client_secret"
      tessa.connector.endpoint: "https://your-tessa-instance.com/api"
      
  5. First Use Case: Sync a Product Image

    • Upload an image to TESSA via Akeneo’s UI.
    • Use the connector to fetch the TESSA asset URL and attach it to a product:
      $product = $productRepository->find(123);
      $tessaService = $this->get('eikona_tessa.connector');
      $assetUrl = $tessaService->getAssetUrl($product->getImage());
      $product->setImage($assetUrl);
      $productManager->save($product);
      

Implementation Patterns

Workflows

  1. Asset Upload Workflow

    • Trigger: User uploads a file (e.g., product_image.jpg) in Akeneo.
    • Action: Connector automatically pushes the file to TESSA and stores the TESSA asset ID in Akeneo’s metadata (e.g., tessa_asset_id field).
    • Code Snippet:
      // In a custom Akeneo event subscriber
      $event = $this->get('eikona_tessa.connector')->uploadAsset(
          $filePath,
          ['product_id' => $product->getId(), 'type' => 'image']
      );
      $product->setTessaAssetId($event->getAssetId());
      
  2. Asset Retrieval Workflow

    • Trigger: Frontend requests a product image.
    • Action: Fetch the TESSA asset URL dynamically:
      $assetUrl = $this->get('eikona_tessa.connector')->getAssetUrl(
          $product->getTessaAssetId()
      );
      return new Response($assetUrl);
      
  3. Bulk Sync

    • Use Akeneo’s job queue to sync all product assets to TESSA:
      $job = new TessaSyncJob($productRepository->findAll());
      $this->get('akeneo.job_executor')->execute($job);
      

Integration Tips

  • Custom Fields: Extend Akeneo’s product model to include TESSA-specific fields (e.g., tessa_asset_id, tessa_metadata).
    # config/akeneo/product.yml
    akeneo_product:
        fields:
            tessa_asset_id: ~
            tessa_metadata: ~
    
  • Webhooks: Configure TESSA to send webhook notifications for asset updates/deletions, then process them via Akeneo’s event system.
  • Caching: Cache TESSA asset URLs to reduce API calls:
    $cache = $this->get('akeneo.cache.warmer');
    $cache->set("tessa_url_{$assetId}", $assetUrl, 3600);
    

Gotchas and Tips

Pitfalls

  1. API Authentication Failures

    • Symptom: 401 Unauthorized errors when calling TESSA.
    • Fix: Verify client_id/client_secret in parameters.yml and ensure TESSA’s OAuth2 server is reachable.
    • Debug: Enable Akeneo’s debug mode and check var/log/dev.log for HTTP client errors.
  2. Missing Akeneo API Permissions

    • Symptom: Connector fails silently during asset uploads.
    • Fix: Ensure the Akeneo API user has READ/WRITE permissions for /api/rest/v1/products.
  3. File Size Limits

    • Symptom: Large files (e.g., videos) fail to upload.
    • Fix: Adjust php.ini (upload_max_filesize, post_max_size) and TESSA’s API limits.
  4. Routing Conflicts

    • Symptom: No route found for /tessa-media/* endpoints.
    • Fix: Ensure the routing entry is last in routing.yml and no other bundle overrides it.

Debugging

  • Enable Connector Logging:
    # app/config/config.yml
    monolog:
        handlers:
            tessa:
                type: stream
                path: "%kernel.logs_dir%/tessa_connector.log"
                level: debug
    
  • Test API Calls Manually: Use curl to verify TESSA API connectivity:
    curl -X GET "https://your-tessa-instance.com/api/assets" \
         -H "Authorization: Bearer YOUR_TOKEN"
    

Extension Points

  1. Custom Asset Metadata Extend the connector to include custom metadata during upload:

    // Override EikonaTessaConnectorBundle/Service/Connector.php
    public function uploadAsset($file, array $metadata = []) {
        $metadata['custom_field'] = 'value';
        return parent::uploadAsset($file, $metadata);
    }
    
  2. Webhook Handlers Create a custom event subscriber for TESSA webhooks:

    // src/Acme/TessaBundle/EventListener/TessaWebhookListener.php
    class TessaWebhookListener implements EventSubscriberInterface {
        public static function getSubscribedEvents() {
            return [
                'tessa.asset.updated' => 'onAssetUpdated',
            ];
        }
    
        public function onAssetUpdated(AssetEvent $event) {
            $product = $this->findProductByTessaId($event->getAssetId());
            $product->setImage($event->getUrl());
            $this->saveProduct($product);
        }
    }
    
  3. Batch Processing Optimize bulk operations by chunking requests:

    $chunkSize = 50;
    foreach (array_chunk($products, $chunkSize) as $chunk) {
        $this->get('eikona_tessa.connector')->syncBatch($chunk);
    }
    
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.
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
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