承接 thelia/customer-scope-module 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

thelia/customer-scope-module

Composer 安装命令:

composer require thelia/customer-scope-module

包简介

README 文档

README

Provide a scope mechanism to associate customers to entities.

Installation

Manually

  • Copy the module into the <thelia_root>/local/modules/ directory and make sure that the name of the module is CustomerScope.
  • Activate it in your Thelia administration panel

Composer

Add it in your main Thelia composer.json file

composer require thelia/customer-scope-module:~0.1

Concepts

A scope is a kind of association that a customer can have. It is defined by a code, and the class of entity that will be associated. Any model class generated by Propel can be used to create a scope.

Scopes must be associated to a scope group.

Customer can be associated to a specific entity instance of a class that has a scope, creating a customer scope. A customer can be associated with any number of entities in any number of scopes. What this association means is up to your business logic.

For exemple, let's say you manage physical stores what to associate customers to them. You can use scopes for that.

Assuming that you have a Store class representing your stores, you can create:

  • A store scope using the Store class
  • A places scope group to contain the store scope

You can then associate a customer to any instance of the Store class, and then easily check to what stores your customer is associated to in your application.

Usage

For the time being, scope and scope groups have to be inserted directly into the database. You could for example do this in a module specific to your site, on activation.

Handler

The customer scope handler service allows you to add customers to scopes, and to check the scopes a customer belongs to.

It is registered in the container under the id customerscope.customerscope.handler. See the CustomerScopeHandler class for the available methods.

Loops

customer-scope

A loop is also available to access the customer scopes.

Input arguments

Argument Description
customer_id Id or list of customer ids.
scope_id Id or list of scope ids.
entity_id Id or list of entity ids.
entity Entity class.

Output arguments

Variable Description
$CUSTOMER_SCOPE_CUSTOMER_ID Customer id.
$CUSTOMER_SCOPE_SCOPE_ID Scope id.
$CUSTOMER_SCOPE_ENTITY_ID Entity id.
$CUSTOMER_SCOPE_SCOPE_ENTITY Entity class.

Query

CustomerQuery

This module provides a CustomerQuery class that extends the base Thelia query and provides methods to filter cutomers by scope.

It can be used in replacement of the base CustomerQuery.

use CustomerScope\Model\CustomerScope as CustomerScopeCustomerQuery;

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

Or mixed in your own query class by using the static methods. These methods take a ModelCriteria query class and will act in it.

They assume that the customer table is already present in the query scope, so your query must for exemple extends CustomerQuery or make a join to the customer table.

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(),
    ]
);

thelia/customer-scope-module 适用场景与选型建议

thelia/customer-scope-module 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 429 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 04 月 27 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 thelia/customer-scope-module 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 thelia/customer-scope-module 我们能提供哪些服务?
定制开发 / 二次开发

基于 thelia/customer-scope-module 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 429
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 19
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 7
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0
  • 更新时间: 2015-04-27