diego-campos-fivebyfive / customer-bundle
Sices 仓库
dev-master
2019-10-23 15:36 UTC
Requires
- php: >=7.0
- friendsofsymfony/user-bundle: ^2.0
- sonata-project/core-bundle: ^3.0
- symfony/framework-bundle: ~2.3|~3.0
Requires (Dev)
- phpunit/phpunit: ~5.7
- sensio/generator-bundle: ~3.0
- symfony/phpunit-bridge: ^4.2
This package is auto-updated.
Last update: 2024-09-24 03:28:40 UTC
README
简化管理客户端,可扩展并与 FOSUserBundle 集成
1. 安装和配置
注意:此包正在开发中!
1.1 使用 composer 下载 KolinaCustomerBundle
$ composer require kolinalabs/customer-bundle
下载包后
1.2 启用捆绑包
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Kolina\CustomerBundle\KolinaCustomerBundle(), // ... ); }
1.3 创建您的客户类 使用 xml 映射测试
<?php // src/AppBundle/Entity/Customer.php namespace AppBundle\Entity; use Kolina\CustomerBundle\Entity\Customer as AbstractCustomer; /** * Customer */ class Customer extends AbstractCustomer { // Your custom properties and methods }
1.4 配置 app/config.yml
# app/config.yml kolina_customer: entity: AppBundle\Entity\Customer
2. CRUD
2.1 在控制器中访问服务管理器
/** * @return \Kolina\CustomerBundle\Entity\CustomerManager */ private function getCustomerManager() { return $this->get('kolina_customer.manager'); }
2.2 示例用法
// Create Customer Object ... $manager = $this->getCustomerManager(); $customer = $manager->create(); $customer ->setFirstname('Foo') ->setLastname('Bar') //... other setter methods - //... see \Kolina\CustomerBundle\Entity\CustomerInterface ; $manager->save($customer); ...