PHP code example of thelia / customer-scope-module

1. Go to this page and download the library: Download thelia/customer-scope-module library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

thelia / customer-scope-module example snippets


use CustomerScope\Model\CustomerScope as CustomerScopeCustomerQuery;

$customers = CustomerScopeCustomerQuery::create()
    ->filterByScope([
        "ScopeEntity" => "myScope",
        "EntityId" => $myEntity->getId(),
    ])
    ->find();

use CustomerScope\Model\CustomerScope as CustomerScopeCustomerQuery;

// MyQuery extends CustomerQuery
// or MyQuery has a join to the customer table somewhere
$myQuery = MyQuery::create();

CustomerScopeCustomerQuery::addScopeFilter(
    $myQuery,
    [
        "ScopeEntity" => "myScope",
        "EntityId" => $myEntity->getId(),
    ]
);