Skip to content

Commit

Permalink
📦 migrate company-type-role from fond-of-spryker (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
julianzimmermann authored Jul 24, 2023
0 parents commit 91d77b6
Show file tree
Hide file tree
Showing 84 changed files with 6,211 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI

on:
push:
branches: [ main ]

jobs:
continous-integration:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-versions: [ "8.0", "8.1", "8.2" ]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, dom, fileinfo, pgsql, json
coverage: xdebug #optional
- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
# Use composer.json for key, if composer.lock is not committed.
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies and run ci tasks
run: make install ci
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.idea

.DS_Store

vendor
composer.lock

src/Generated
src/Orm
9 changes: 9 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The MIT License (MIT)

Copyright (c) 2023-present FOND OF GmbH

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.PHONY: update
update:
composer update

.PHONY: install
install:
composer install --no-dev

.PHONY: install-dev
install-dev:
composer install

.PHONY: phpcs
phpcs:
./vendor/bin/phpcs --standard=./vendor/spryker/code-sniffer/Spryker/ruleset.xml ./src/FondOfImpala/ ./tests/FondOfImpala/

.PHONY: phpcbf
phpcbf:
./vendor/bin/phpcbf --standard=./vendor/spryker/code-sniffer/Spryker/ruleset.xml ./src/FondOfImpala/ ./tests/FondOfImpala/

.PHONY: phpstan
phpstan:
php -d memory_limit=-1 ./vendor/bin/phpstan analyse -l 4 ./src/FondOfImpala

.PHONY: codeception
codeception:
./vendor/bin/codecept run --env standalone --coverage --coverage-xml --coverage-html

.PHONY: ci
ci: phpcs codeception phpstan
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Company Type Role Module
[![Build Status](https://travis-ci.org/fond-of-impala/company-type-role.svg?branch=master)](https://travis-ci.org/fond-of-impala/company-type-role)
[![PHP from Travis config](https://img.shields.io/travis/php-v/fond-of-impala/company-type-role.svg)](https://php.net/)
[![license](https://img.shields.io/github/license/fond-of-impala/company-type-role.svg)](https://packagist.org/packages/fond-of-impala/company-type-role)

## Installation

```
composer require fond-of-impala/company-type-role
```
43 changes: 43 additions & 0 deletions codeception.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
namespace: fond-of-impala/company-type-role

suites:
unit:
path: .

settings:
shuffle: true
lint: true

bootstrap: _bootstrap.php

paths:
tests: tests
output: tests/_output
support: tests/_support
data: tests/_data

coverage:
enabled: true
include:
- src/*.php

modules:
enabled:
- \FondOfCodeception\Module\Spryker
config:
\FondOfCodeception\Module\Spryker:
generate_transfer: false
generate_map_classes: false
generate_propel_classes: false
generate_ide_auto_completion: false

env:
standalone:
modules:
config:
\FondOfCodeception\Module\Spryker:
generate_transfer: true
generate_map_classes: true
generate_propel_classes: true
generate_ide_auto_completion: true
monorepo:
50 changes: 50 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "fond-of-impala/company-type-role",
"description": "Company type role module",
"license": "MIT",
"authors": [
{
"name": "Daniel Rose",
"email": "daniel-rose@gmx.de"
}
],
"scripts": {
"ci": "make ci",
"codeception": "make codeception",
"phpcs": "make phpcs",
"phpstan": "make phpstan"
},
"require": {
"php": ">=8.0",
"fond-of-spryker/company-type": "dev-master",
"fond-of-spryker/jellyfish-b2b-extension": "dev-master",
"spryker/company-role": "^1.0.0",
"spryker/company-user": "^1.0.0 || ^2.0.0",
"spryker/permission": "^1.2.0",
"spryker/permission-extension": "^1.0.0"
},
"require-dev": {
"fond-of-codeception/spryker": "*",
"spryker/code-sniffer": "*",
"spryker-sdk/phpstan-spryker": "*"
},
"minimum-stability": "dev",
"prefer-stable": true,
"autoload": {
"psr-4": {
"FondOfImpala\\": "src/FondOfImpala/"
}
},
"autoload-dev": {
"psr-4": {
"FondOfImpala\\": "tests/FondOfImpala/",
"Generated\\": "src/Generated/",
"Orm\\Zed\\": "src/Orm/Zed/"
}
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
8 changes: 8 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
parameters:
level: 4
reportUnmatchedIgnoredErrors: false
scanDirectories:
- src/Orm/Zed
- src/Generated
ignoreErrors:
- '#.* on an unknown class Generated\\(Client|Glue|Service|Yves|Zed)\\Ide\\AutoCompletion.*#'
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace FondOfImpala\Shared\CompanyTypeRole;

interface CompanyTypeRoleConstants
{
/**
* @var string
*/
public const PERMISSION_KEYS = 'COMPANY_TYPE_ROLE:PERMISSION_KEYS';

/**
* @var string
*/
public const VALID_COMPANY_TYPE_NAMES = 'COMPANY_TYPE_ROLE:VALID_COMPANY_TYPE_NAMES';

/**
* @var string
*/
public const VALID_COMPANY_ROLES_FOR_EXPORT = 'COMPANY_TYPE_ROLE:VALID_COMPANY_ROLES_FOR_EXPORT';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0"?>
<transfers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="spryker:transfer-01"
xsi:schemaLocation="spryker:transfer-01 http://static.spryker.com/transfer-01.xsd">
<transfer name="EventEntity">
<property name="name" type="string"/>
<property name="id" type="int"/>
<property name="foreignKeys" type="array" singular="foreignKeys"/>
</transfer>

<transfer name="CompanyType">
<property name="name" type="string" />
</transfer>

<transfer name="CompanyRole">
<property name="name" type="string"/>
<property name="isDefault" type="bool"/>
<property name="fkCompany" type="int"/>
<property name="permissionCollection" type="PermissionCollection"/>
</transfer>

<transfer name="Company">
<property name="idCompany" type="int"/>
<property name="companyType" type="CompanyType"/>
</transfer>

<transfer name="Permission">
<property name="key" type="string"/>
</transfer>

<transfer name="AssignableCompanyRoleCriteriaFilter">
<property name="idCustomer" type="int"/>
<property name="idCompany" type="int"/>
</transfer>
</transfers>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace FondOfImpala\Zed\CompanyTypeRole\Business\Builder;

use Generated\Shared\Transfer\CompanyRoleCriteriaFilterTransfer;
use Generated\Shared\Transfer\FilterTransfer;
use Generated\Shared\Transfer\PaginationTransfer;
use Orm\Zed\CompanyRole\Persistence\Map\SpyCompanyRoleTableMap;

class CompanyRoleCriteriaFilterBuilder implements CompanyRoleCriteriaFilterBuilderInterface
{
/**
* @param int $page
* @param int $maxPerPage
*
* @return \Generated\Shared\Transfer\CompanyRoleCriteriaFilterTransfer
*/
public function buildByPageAndMaxPerPage(int $page, int $maxPerPage): CompanyRoleCriteriaFilterTransfer
{
$filterTransfer = (new FilterTransfer())
->setOrderBy(SpyCompanyRoleTableMap::COL_ID_COMPANY_ROLE)
->setOrderDirection('asc');

$paginationTransfer = (new PaginationTransfer())
->setPage($page)
->setMaxPerPage($maxPerPage);

return (new CompanyRoleCriteriaFilterTransfer())
->setFilter($filterTransfer)
->setPagination($paginationTransfer);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace FondOfImpala\Zed\CompanyTypeRole\Business\Builder;

use Generated\Shared\Transfer\CompanyRoleCriteriaFilterTransfer;

interface CompanyRoleCriteriaFilterBuilderInterface
{
/**
* @param int $page
* @param int $maxPerPage
*
* @return \Generated\Shared\Transfer\CompanyRoleCriteriaFilterTransfer
*/
public function buildByPageAndMaxPerPage(int $page, int $maxPerPage): CompanyRoleCriteriaFilterTransfer;
}
Loading

0 comments on commit 91d77b6

Please sign in to comment.