cycle / orm

PHP DataMapper, ORM
https://cycle-orm.dev
MIT License
1.23k stars 72 forks source link

cycle\ORM\Exception\TransactionException Transaction can't be finished. Some relations can't be resolved: Update `product` - tax_rate (Cycle\ORM\Relation\BelongsTo)πŸ› #348

Closed rossaddison closed 2 years ago

rossaddison commented 2 years ago

No duplicates πŸ₯².

What happened?

Ubuntu 22.04 LTS Testing and Wampserver 3.2.9 Testing Above error common to both Windows and Ubuntu Apache2 using fork rossaddison/yii-invoice. Event: A new product, not used in any quote, or invoice, when tax_rate_id BelongsTo dropdown edited and saved. Also if the product's family group BelongsTo relation changes, and is saved, same error occurs.

This error occurs when the record is edited, not created.

This error did not occur when I was using annotations instead of the current Atributes. This issue is similar to issue #329

Here is the entity that is being used:

<?php

declare(strict_types=1);

namespace App\Invoice\Entity;

use Cycle\Annotated\Annotation\Column;
use Cycle\Annotated\Annotation\Entity;
use App\Invoice\Entity\Family;
use App\Invoice\Entity\TaxRate;
use App\Invoice\Entity\Unit;
use Cycle\Annotated\Annotation\Relation\BelongsTo;

#[Entity(repository: \App\Invoice\Product\ProductRepository::class)]
class Product
{
    #[Column(type: 'primary')]
    private ?int $id = null;

    #[Column(type: 'text', nullable: true)]
    private ?string $product_sku = '';

    #[Column(type: 'text', nullable: true)]
    private ?string $product_name = '';

    #[Column(type: 'longText', nullable: false)]
    private ?string $product_description = '';

    #[Column(type: 'decimal(20,2)', nullable: true)]
    private ?float $product_price = null;

    #[Column(type: 'decimal(20,2)', nullable: true)]
    private ?float $purchase_price = null;

    #[Column(type: 'text', nullable: true)]
    private ?string $provider_name = '';

    #[BelongsTo(target:Family::class, nullable: false, fkAction: "NO ACTION")]
    private ?Family $family = null;        
    #[Column(type: 'integer(11)', nullable: true)]
    private ?int $family_id = null;

    // A product has to have a tax rate before it can be created even if it is a zero tax rate    
    #[BelongsTo(target:TaxRate::class, nullable: false, fkAction: "NO ACTION")]
    private ?TaxRate $tax_rate = null;    
    #[Column(type: 'integer(11)', nullable: false)]
    private ?int $tax_rate_id = null;

    #[BelongsTo(target:Unit::class, nullable: false, fkAction: "NO ACTION")]
    private ?Unit $unit = null;    
    #[Column(type: 'integer(11)', nullable: true)]
    private ?int $unit_id = null;

    #[Column(type: 'integer(11)', nullable: true)]
    private ?int $product_tariff = null;

    public function __construct(
        string $product_sku = '',
        string $product_name = '',
        string $product_description = '',
        float $product_price = null,
        float $purchase_price = null,
        string $provider_name = '',
        int $product_tariff = null,
        int $tax_rate_id = null,
        int $family_id = null,
        int $unit_id = null            
    )
    {
        $this->product_sku = $product_sku;  
        $this->product_name = $product_name;
        $this->product_description = $product_description;
        $this->product_price = $product_price;
        $this->purchase_price = $purchase_price;
        $this->provider_name = $provider_name;
        $this->product_tariff = $product_tariff;
        $this->tax_rate_id = $tax_rate_id;
        $this->family_id = $family_id;
        $this->unit_id = $unit_id;
    }
    //relation $family
    public function getFamily(): ?Family
    {
        return $this->family;
    }
    //relation $tax_rate
    public function getTaxrate(): ?TaxRate
    {
        return $this->tax_rate;
    }
    //relation $unit
    public function getUnit(): ?Unit
    {
        return $this->unit;
    }    

    public function getProduct_id(): ?string
    {
        return (string)$this->id;
    }

    public function setFamily_id(int $family_id): void
    {
        $this->family_id = $family_id;
    }

    public function getProduct_sku(): string
    {
        return $this->product_sku;
    }

    public function setProduct_sku(string $product_sku): void
    {
        $this->product_sku = $product_sku;
    }

    public function getProduct_name(): string
    {
        return $this->product_name;
    }

    public function setProduct_name(string $product_name): void
    {
        $this->product_name = $product_name;
    }

    public function getProduct_description(): string
    {
        return $this->product_description;
    }

    public function setProduct_description(string $product_description): void
    {
        $this->product_description = $product_description;
    }

    public function getProduct_price(): float
    {
        return $this->product_price;
    }

    public function setProduct_price(float $product_price): void
    {
        $this->product_price = $product_price;
    }

    public function getPurchase_price(): float
    {
        return $this->purchase_price;
    }

    public function setPurchase_price(float $purchase_price): void
    {
        $this->purchase_price = $purchase_price;
    }

    public function getProvider_name(): string
    {
        return $this->provider_name;
    }

    public function setProvider_name(string $provider_name): void
    {
        $this->provider_name = $provider_name;
    }

    public function setTax_rate_id(int $tax_rate_id): void
    {
        $this->tax_rate_id = $tax_rate_id;
    }

    public function getTax_rate_id(): ?int
    {
        return $this->tax_rate_id;
    }

    public function setUnit_id(int $unit_id): void
    {
        $this->unit_id = $unit_id;
    }

    public function getUnit_id(): ?int
    {
        return $this->unit_id;
    }

    public function getFamily_id(): ?int
    {
        return $this->family_id;
    }

    public function getProduct_tariff(): int
    {
        return $this->product_tariff;
    }

    public function setProduct_tariff(int $product_tariff): void
    {
        $this->product_tariff = $product_tariff;
    }
}

Version

ORM 2.0.0 
Ubuntu PHP 8.1.2, Wampserver PHP 8.1.7
roxblnfk commented 2 years ago

Hello.

ORM 2.0.0

Can you update the orm to v2.1.1?

roxblnfk commented 2 years ago

About BelongsTo relation: Can you check that PR is about your issue? https://github.com/cycle/orm/pull/347

rossaddison commented 2 years ago

Hi Aleksei,

I have had a look at #347.

Here is my stack trace.

Cycle\ORM\Exception\TransactionException: Transaction can't be finished. Some relations can't be resolved:
Update `product`
 - family (Cycle\ORM\Relation\BelongsTo) in /var/www/html/yii-invoice/vendor/cycle/orm/src/Exception/TransactionException.php:40
Stack trace:
#0 /var/www/html/yii-invoice/vendor/cycle/orm/src/Transaction/UnitOfWork.php(104): Cycle\ORM\Exception\TransactionException::unresolvedRelations()
#1 /var/www/html/yii-invoice/vendor/cycle/orm/src/EntityManager.php(47): Cycle\ORM\Transaction\UnitOfWork->run()
#2 /var/www/html/yii-invoice/vendor/yiisoft/yii-cycle/src/Data/Writer/EntityWriter.php(25): Cycle\ORM\EntityManager->run()
#3 /var/www/html/yii-invoice/src/Invoice/Product/ProductRepository.php(59): Yiisoft\Yii\Cycle\Data\Writer\EntityWriter->write()
#4 /var/www/html/yii-invoice/src/Invoice/Product/ProductService.php(30): App\Invoice\Product\ProductRepository->save()
#5 /var/www/html/yii-invoice/src/Invoice/Product/ProductController.php(244): App\Invoice\Product\ProductService->saveProduct()
#6 [internal function]: App\Invoice\Product\ProductController->edit()
#7 /var/www/html/yii-invoice/vendor/yiisoft/injector/src/Injector.php(66): ReflectionFunction->invokeArgs()
#8 /var/www/html/yii-invoice/vendor/yiisoft/middleware-dispatcher/src/MiddlewareFactory.php(89): Yiisoft\Injector\Injector->invoke()
#9 /var/www/html/yii-invoice/vendor/yiisoft/middleware-dispatcher/src/MiddlewareStack.php(104): ***@***.***>process()
#10 /var/www/html/yii-invoice/vendor/yiisoft/auth/src/Middleware/Authentication.php(57): ***@***.***>handle()
#11 /var/www/html/yii-invoice/vendor/yiisoft/middleware-dispatcher/src/MiddlewareStack.php(104): Yiisoft\Auth\Middleware\Authentication->process()
#12 /var/www/html/yii-invoice/src/Middleware/AccessChecker.php(39): ***@***.***>handle()
#13 /var/www/html/yii-invoice/vendor/yiisoft/middleware-dispatcher/src/MiddlewareFactory.php(126): App\Middleware\AccessChecker->process()
#14 /var/www/html/yii-invoice/vendor/yiisoft/middleware-dispatcher/src/MiddlewareStack.php(104): ***@***.***>process()
#15 /var/www/html/yii-invoice/vendor/yiisoft/yii-debug-viewer/src/Middleware/ToolbarMiddleware.php(33): ***@***.***>handle()
#16 /var/www/html/yii-invoice/vendor/yiisoft/middleware-dispatcher/src/MiddlewareStack.php(104): Yiisoft\Yii\Debug\Viewer\Middleware\ToolbarMiddleware->process()
#17 /var/www/html/yii-invoice/vendor/yiisoft/data-response/src/Middleware/FormatDataResponse.php(29): ***@***.***>handle()
#18 /var/www/html/yii-invoice/vendor/yiisoft/middleware-dispatcher/src/MiddlewareStack.php(104): Yiisoft\DataResponse\Middleware\FormatDataResponse->process()
#19 /var/www/html/yii-invoice/vendor/yiisoft/csrf/src/CsrfMiddleware.php(48): ***@***.***>handle()
#20 /var/www/html/yii-invoice/vendor/yiisoft/middleware-dispatcher/src/MiddlewareStack.php(104): Yiisoft\Csrf\CsrfMiddleware->process()
#21 /var/www/html/yii-invoice/vendor/yiisoft/yii-debug-api/src/Middleware/DebugHeaders.php(31): ***@***.***>handle()
#22 /var/www/html/yii-invoice/vendor/yiisoft/middleware-dispatcher/src/MiddlewareStack.php(104): Yiisoft\Yii\Debug\Api\Middleware\DebugHeaders->process()
#23 /var/www/html/yii-invoice/vendor/yiisoft/middleware-dispatcher/src/MiddlewareStack.php(53): ***@***.***>handle()
#24 /var/www/html/yii-invoice/vendor/yiisoft/middleware-dispatcher/src/MiddlewareDispatcher.php(50): Yiisoft\Middleware\Dispatcher\MiddlewareStack->handle()
#25 /var/www/html/yii-invoice/vendor/yiisoft/router/src/MatchingResult.php(116): Yiisoft\Middleware\Dispatcher\MiddlewareDispatcher->dispatch()
#26 /var/www/html/yii-invoice/vendor/yiisoft/router/src/Middleware/Router.php(61): Yiisoft\Router\MatchingResult->process()
#27 /var/www/html/yii-invoice/vendor/yiisoft/middleware-dispatcher/src/MiddlewareStack.php(104): Yiisoft\Router\Middleware\Router->process()
#28 /var/www/html/yii-invoice/src/Middleware/LocaleMiddleware.php(95): ***@***.***>handle()
#29 /var/www/html/yii-invoice/vendor/yiisoft/middleware-dispatcher/src/MiddlewareStack.php(104): App\Middleware\LocaleMiddleware->process()
#30 /var/www/html/yii-invoice/vendor/yiisoft/user/src/Login/Cookie/CookieLoginMiddleware.php(71): ***@***.***>handle()
#31 /var/www/html/yii-invoice/vendor/yiisoft/middleware-dispatcher/src/MiddlewareStack.php(104): Yiisoft\User\Login\Cookie\CookieLoginMiddleware->process()
#32 /var/www/html/yii-invoice/vendor/yiisoft/cookies/src/CookieMiddleware.php(84): ***@***.***>handle()
#33 /var/www/html/yii-invoice/vendor/yiisoft/middleware-dispatcher/src/MiddlewareStack.php(104): Yiisoft\Cookies\CookieMiddleware->process()
#34 /var/www/html/yii-invoice/vendor/yiisoft/session/src/SessionMiddleware.php(36): ***@***.***>handle()
#35 /var/www/html/yii-invoice/vendor/yiisoft/middleware-dispatcher/src/MiddlewareStack.php(104): Yiisoft\Session\SessionMiddleware->process()
#36 /var/www/html/yii-invoice/vendor/yiisoft/error-handler/src/Middleware/ErrorCatcher.php(135): ***@***.***>handle()
#37 /var/www/html/yii-invoice/vendor/yiisoft/middleware-dispatcher/src/MiddlewareStack.php(104): Yiisoft\ErrorHandler\Middleware\ErrorCatcher->process()
#38 /var/www/html/yii-invoice/vendor/yiisoft/middleware-dispatcher/src/MiddlewareStack.php(53): ***@***.***>handle()
#39 /var/www/html/yii-invoice/vendor/yiisoft/middleware-dispatcher/src/MiddlewareDispatcher.php(50): Yiisoft\Middleware\Dispatcher\MiddlewareStack->handle()
#40 /var/www/html/yii-invoice/vendor/yiisoft/yii-http/src/Application.php(87): Yiisoft\Middleware\Dispatcher\MiddlewareDispatcher->dispatch()
#41 /var/www/html/yii-invoice/vendor/yiisoft/yii-runner-http/src/HttpApplicationRunner.php(105): Yiisoft\Yii\Http\Application->handle()
#42 /var/www/html/yii-invoice/public/index.php(36): Yiisoft\Yii\Runner\Http\HttpApplicationRunner->run()
#43 {main}

My repo is publicly available at github.com/rossaddison/yii-invoice if you want to set it up.


From: Aleksei Gagarin @.> Sent: 21 June 2022 16:28 To: cycle/orm @.> Cc: Ross Addison @.>; Author @.> Subject: Re: [cycle/orm] cycle\ORM\Exception\TransactionException Transaction can't be finished. Some relations can't be resolved: Update product - tax_rate (Cycle\ORM\Relation\BelongsTo)πŸ› (Issue #348)

About BelongsTo relation: Can you check that PR is about your issue? #347https://github.com/cycle/orm/pull/347

β€” Reply to this email directly, view it on GitHubhttps://github.com/cycle/orm/issues/348#issuecomment-1161916137, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACBERY536QCR4ZRTFDUZHGDVQHNQ3ANCNFSM5ZMKPQZQ. You are receiving this because you authored the thread.Message ID: @.***>

rossaddison commented 2 years ago

[cid:e78b8164-f878-43ad-a55a-574724011f87]

composer.json

"require": { "php": "^8.0", "ext-mbstring": "", "ext-pdo_sqlite": "", "cebe/markdown": @.**", "cycle/database": "^2.0", "cycle/entity-behavior": "^1.0", "cycle/orm": "^2.1.1", "doctrine/collections": "^1.6", "fakerphp/faker": "^1.14", "httpsoft/http-message": "^1.0.5", "mpdf/mpdf": "",


From: Ross Addison @.> Sent: 21 June 2022 18:16 To: cycle/orm @.> Subject: Re: [cycle/orm] cycle\ORM\Exception\TransactionException Transaction can't be finished. Some relations can't be resolved: Update product - tax_rate (Cycle\ORM\Relation\BelongsTo)πŸ› (Issue #348)

Hi Aleksei,

I have had a look at #347.

Here is my stack trace.

Cycle\ORM\Exception\TransactionException: Transaction can't be finished. Some relations can't be resolved: Update product

My repo is publicly available at github.com/rossaddison/yii-invoice if you want to set it up.


From: Aleksei Gagarin @.> Sent: 21 June 2022 16:28 To: cycle/orm @.> Cc: Ross Addison @.>; Author @.> Subject: Re: [cycle/orm] cycle\ORM\Exception\TransactionException Transaction can't be finished. Some relations can't be resolved: Update product - tax_rate (Cycle\ORM\Relation\BelongsTo)πŸ› (Issue #348)

About BelongsTo relation: Can you check that PR is about your issue? #347https://github.com/cycle/orm/pull/347

β€” Reply to this email directly, view it on GitHubhttps://github.com/cycle/orm/issues/348#issuecomment-1161916137, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACBERY536QCR4ZRTFDUZHGDVQHNQ3ANCNFSM5ZMKPQZQ. You are receiving this because you authored the thread.Message ID: @.***>

roxblnfk commented 2 years ago

Could you render the ORM Schema in a PHP format and show here?

TiaNex-Com commented 2 years ago

public function setTax_rate( $tax_rate ): void { $this->tax_rate = $tax_rate ; }

do you have the code $product->setTax_rate( $tax_rate ); or $tax_rate->addProduct($product);

rossaddison commented 2 years ago

This is the _form:

```
```
rossaddison commented 2 years ago

This is the controller:

public function edit(ViewRenderer $head, SessionInterface $session, Request $request, CurrentRoute $currentRoute, ValidatorInterface $validator,
                    pR $pR, sR $sR, fR $fR, uR $uR, trR $trR, 
    ): Response {
        $this->rbac();
        $parameters = [
            'title' => $sR->trans('edit'),
            'action' => ['product/edit', ['id' => $this->product($currentRoute, $pR)->getProduct_id()]],
            'errors' => [],
            'body' => $this->body($this->product($currentRoute, $pR)),
            's'=>$sR,
            'head'=>$head,
            'families'=>$fR->findAllPreloaded(),
            'units'=>$uR->findAllPreloaded(),
            'tax_rates'=>$trR->findAllPreloaded()    
        ];
        if ($request->getMethod() === Method::POST) {
            $form = new ProductForm();
            $body = $request->getParsedBody();
            if ($form->load($body) && $validator->validate($form)->isValid()) {
                $this->productService->saveProduct($this->product($currentRoute, $pR), $form);  
                $this->flash('info', $sR->trans('record_successfully_updated'));
                return $this->webService->getRedirectResponse('product/index');   
            }
            $parameters['body'] = $body;
            $parameters['errors'] = $form->getFormErrors();
        }
        // BelongsTo bug: => render a form different to _form with BelongTo fields family_id, unit_id, tax_rate_id hidden.
        // The user will have to delete the product / service. This deletion will be prevented if the product exists on 
        // a quote or invoice. 
        return $this->viewRenderer->render('_form_edit', $parameters);
    }
rossaddison commented 2 years ago

This is the service:

public function saveProduct(Product $model, ProductForm $form): void
    {
        $model->setProduct_sku($form->getProduct_sku());
        $model->setProduct_name($form->getProduct_name());
        $model->setProduct_description($form->getProduct_description());
        $model->setProduct_price($form->getProduct_price());
        $model->setPurchase_price($form->getPurchase_price());
        $model->setProvider_name($form->getProvider_name());
        $model->setProduct_tariff($form->getProduct_tariff()); 
        $model->setTax_rate_id((int)$form->getTax_rate_id());
        $model->setUnit_id((int)$form->getUnit_id());
        $model->setFamily_id((int)$form->getFamily_id());

        $this->repository->save($model);
    }
rossaddison commented 2 years ago

This is the Form code:

``` product_sku; } public function getProduct_name(): string|null { return $this->product_name; } public function getProduct_description(): string|null { return $this->product_description; } public function getProduct_price(): float|null { return $this->product_price; } public function getPurchase_price(): float|null { return $this->purchase_price; } public function getProvider_name(): string|null { return $this->provider_name; } public function getFamily_id(): string|null { return $this->family_id; } public function getTax_rate_id(): string|null { return $this->tax_rate_id; } public function getUnit_id(): string|null { return $this->unit_id; } public function getProduct_tariff(): int|null { return $this->product_tariff; } public function getFormName(): string { return ''; } public function getRules(): array { return [ 'family_id' => [new Required()], 'product_name' => [new Required()], 'tax_rate_id' => [new Required()], ]; } } ```
rossaddison commented 2 years ago

How do you render the Orm schema?

butschster commented 2 years ago

github.com/rossaddison/yii-invoice

You can use https://github.com/cycle/schema-renderer for schema rendering

roxblnfk commented 2 years ago

How do you render the Orm schema?

https://github.com/yiisoft/yii-cycle/blob/master/docs/en/console-commands.md#common

cycle/schema/php [file] - Export current schema as PHP file

rossaddison commented 2 years ago

This is schema:

image

rossaddison commented 2 years ago

Schema php

```php [ Schema::ENTITY => 'App\\Auth\\Identity', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Auth\\IdentityRepository', Schema::DATABASE => 'default', Schema::TABLE => 'identity', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'authKey' => 'auth_key', 'user_id' => 'user_id', ], Schema::RELATIONS => [ 'user' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'user', Relation::LOAD => Relation::LOAD_EAGER, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'user_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'user_id' => 'int', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'comment' => [ Schema::ENTITY => 'App\\Blog\\Entity\\Comment', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Blog\\Comment\\CommentRepository', Schema::DATABASE => 'default', Schema::TABLE => 'comment', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'public' => 'public', 'content' => 'content', 'created_at' => 'created_at', 'updated_at' => 'updated_at', 'published_at' => 'published_at', 'deleted_at' => 'deleted_at', 'user_id' => 'user_id', 'post_id' => 'post_id', ], Schema::RELATIONS => [ 'user' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'user', Relation::LOAD => Relation::LOAD_EAGER, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'user_id', Relation::OUTER_KEY => ['id'], ], ], 'post' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'post', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'post_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => 'App\\Blog\\Comment\\Scope\\PublicScope', Schema::TYPECAST => [ 'id' => 'int', 'public' => 'bool', 'created_at' => 'datetime', 'updated_at' => 'datetime', 'published_at' => 'datetime', 'deleted_at' => 'datetime', 'user_id' => 'int', 'post_id' => 'int', ], Schema::SCHEMA => [], Schema::LISTENERS => [ [ 'Cycle\\ORM\\Entity\\Behavior\\Listener\\CreatedAt', [ 'field' => 'created_at', ], ], [ 'Cycle\\ORM\\Entity\\Behavior\\Listener\\UpdatedAt', [ 'field' => 'updated_at', 'nullable' => false, ], ], [ 'Cycle\\ORM\\Entity\\Behavior\\Listener\\SoftDelete', [ 'field' => 'deleted_at', ], ], ], Schema::TYPECAST_HANDLER => null, ], 'post' => [ Schema::ENTITY => 'App\\Blog\\Entity\\Post', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Blog\\Post\\PostRepository', Schema::DATABASE => 'default', Schema::TABLE => 'post', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'slug' => 'slug', 'title' => 'title', 'public' => 'public', 'content' => 'content', 'created_at' => 'created_at', 'updated_at' => 'updated_at', 'published_at' => 'published_at', 'deleted_at' => 'deleted_at', 'user_id' => 'user_id', ], Schema::RELATIONS => [ 'user' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'user', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'user_id', Relation::OUTER_KEY => ['id'], ], ], 'tags' => [ Relation::TYPE => Relation::MANY_TO_MANY, Relation::TARGET => 'tag', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::WHERE => [], Relation::ORDER_BY => [], Relation::INNER_KEY => ['id'], Relation::OUTER_KEY => ['id'], Relation::THROUGH_ENTITY => 'postTag', Relation::THROUGH_INNER_KEY => 'post_id', Relation::THROUGH_OUTER_KEY => 'tag_id', Relation::THROUGH_WHERE => [], '4' => null, ], ], 'comments' => [ Relation::TYPE => Relation::HAS_MANY, Relation::TARGET => 'comment', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::WHERE => [], Relation::ORDER_BY => [], Relation::INNER_KEY => ['id'], Relation::OUTER_KEY => 'post_id', '4' => null, ], ], ], Schema::SCOPE => 'App\\Blog\\Post\\Scope\\PublicScope', Schema::TYPECAST => [ 'id' => 'int', 'public' => 'bool', 'created_at' => 'datetime', 'updated_at' => 'datetime', 'published_at' => 'datetime', 'deleted_at' => 'datetime', 'user_id' => 'int', ], Schema::SCHEMA => [], Schema::LISTENERS => [ [ 'Cycle\\ORM\\Entity\\Behavior\\Listener\\CreatedAt', [ 'field' => 'created_at', ], ], [ 'Cycle\\ORM\\Entity\\Behavior\\Listener\\UpdatedAt', [ 'field' => 'updated_at', 'nullable' => false, ], ], [ 'Cycle\\ORM\\Entity\\Behavior\\Listener\\SoftDelete', [ 'field' => 'deleted_at', ], ], ], Schema::TYPECAST_HANDLER => null, ], 'postTag' => [ Schema::ENTITY => 'App\\Blog\\Entity\\PostTag', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'Cycle\\ORM\\Select\\Repository', Schema::DATABASE => 'default', Schema::TABLE => 'post_tag', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'post_id' => 'post_id', 'tag_id' => 'tag_id', ], Schema::RELATIONS => [], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'post_id' => 'int', 'tag_id' => 'int', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'tag' => [ Schema::ENTITY => 'App\\Blog\\Entity\\Tag', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Blog\\Tag\\TagRepository', Schema::DATABASE => 'default', Schema::TABLE => 'tag', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'label' => 'label', 'created_at' => 'created_at', ], Schema::RELATIONS => [ 'posts' => [ Relation::TYPE => Relation::MANY_TO_MANY, Relation::TARGET => 'post', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::WHERE => [], Relation::ORDER_BY => [], Relation::INNER_KEY => ['id'], Relation::OUTER_KEY => ['id'], Relation::THROUGH_ENTITY => 'postTag', Relation::THROUGH_INNER_KEY => 'tag_id', Relation::THROUGH_OUTER_KEY => 'post_id', Relation::THROUGH_WHERE => [], '4' => null, ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'created_at' => 'datetime', ], Schema::SCHEMA => [], Schema::LISTENERS => [ [ 'Cycle\\ORM\\Entity\\Behavior\\Listener\\CreatedAt', [ 'field' => 'created_at', ], ], ], Schema::TYPECAST_HANDLER => null, ], 'client' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\Client', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\Client\\ClientRepository', Schema::DATABASE => 'default', Schema::TABLE => 'client', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'client_date_created' => 'client_date_created', 'client_date_modified' => 'client_date_modified', 'client_name' => 'client_name', 'client_address_1' => 'client_address_1', 'client_address_2' => 'client_address_2', 'client_city' => 'client_city', 'client_state' => 'client_state', 'client_zip' => 'client_zip', 'client_country' => 'client_country', 'client_phone' => 'client_phone', 'client_fax' => 'client_fax', 'client_mobile' => 'client_mobile', 'client_email' => 'client_email', 'client_web' => 'client_web', 'client_vat_id' => 'client_vat_id', 'client_tax_code' => 'client_tax_code', 'client_language' => 'client_language', 'client_active' => 'client_active', 'client_surname' => 'client_surname', 'client_avs' => 'client_avs', 'client_insurednumber' => 'client_insurednumber', 'client_veka' => 'client_veka', 'client_birthdate' => 'client_birthdate', 'client_gender' => 'client_gender', ], Schema::RELATIONS => [], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'client_date_created' => 'datetime', 'client_date_modified' => 'datetime', 'client_active' => 'bool', 'client_birthdate' => 'datetime', 'client_gender' => 'int', ], Schema::SCHEMA => [], Schema::LISTENERS => [ [ 'Cycle\\ORM\\Entity\\Behavior\\Listener\\CreatedAt', [ 'field' => 'client_date_created', ], ], [ 'Cycle\\ORM\\Entity\\Behavior\\Listener\\UpdatedAt', [ 'field' => 'client_date_modified', 'nullable' => false, ], ], ], Schema::TYPECAST_HANDLER => null, ], 'clientCustom' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\ClientCustom', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\ClientCustom\\ClientCustomRepository', Schema::DATABASE => 'default', Schema::TABLE => 'client_custom', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'client_id' => 'client_id', 'custom_field_id' => 'custom_field_id', 'value' => 'value', ], Schema::RELATIONS => [ 'client' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'client', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'client_id', Relation::OUTER_KEY => ['id'], ], ], 'custom_field' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'customField', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'custom_field_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'client_id' => 'int', 'custom_field_id' => 'int', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'clientNote' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\ClientNote', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\ClientNote\\ClientNoteRepository', Schema::DATABASE => 'default', Schema::TABLE => 'client_note', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'client_id' => 'client_id', 'date' => 'date', 'note' => 'note', ], Schema::RELATIONS => [ 'client' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'client', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'client_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'client_id' => 'int', 'date' => 'datetime', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'company' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\Company', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\Company\\CompanyRepository', Schema::DATABASE => 'default', Schema::TABLE => 'company', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'current' => 'current', 'name' => 'name', 'address_1' => 'address_1', 'address_2' => 'address_2', 'city' => 'city', 'state' => 'state', 'zip' => 'zip', 'country' => 'country', 'phone' => 'phone', 'fax' => 'fax', 'email' => 'email', 'web' => 'web', 'date_created' => 'date_created', 'date_modified' => 'date_modified', ], Schema::RELATIONS => [], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'current' => 'int', 'date_created' => 'datetime', 'date_modified' => 'datetime', ], Schema::SCHEMA => [], Schema::LISTENERS => [ [ 'Cycle\\ORM\\Entity\\Behavior\\Listener\\CreatedAt', [ 'field' => 'date_created', ], ], [ 'Cycle\\ORM\\Entity\\Behavior\\Listener\\UpdatedAt', [ 'field' => 'date_modified', 'nullable' => false, ], ], ], Schema::TYPECAST_HANDLER => null, ], 'companyPrivate' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\CompanyPrivate', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\CompanyPrivate\\CompanyPrivateRepository', Schema::DATABASE => 'default', Schema::TABLE => 'company_private', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'company_id' => 'company_id', 'vat_id' => 'vat_id', 'tax_code' => 'tax_code', 'iban' => 'iban', 'gln' => 'gln', 'rcc' => 'rcc', 'date_created' => 'date_created', 'date_modified' => 'date_modified', ], Schema::RELATIONS => [ 'company' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'company', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'company_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'company_id' => 'int', 'gln' => 'int', 'date_created' => 'datetime', 'date_modified' => 'datetime', ], Schema::SCHEMA => [], Schema::LISTENERS => [ [ 'Cycle\\ORM\\Entity\\Behavior\\Listener\\UpdatedAt', [ 'field' => 'date_modified', 'nullable' => false, ], ], ], Schema::TYPECAST_HANDLER => null, ], 'customField' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\CustomField', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\CustomField\\CustomFieldRepository', Schema::DATABASE => 'default', Schema::TABLE => 'custom_field', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'table' => 'table', 'label' => 'label', 'type' => 'type', 'location' => 'location', 'order' => 'order', ], Schema::RELATIONS => [], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'location' => 'int', 'order' => 'int', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'customValue' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\CustomValue', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\CustomValue\\CustomValueRepository', Schema::DATABASE => 'default', Schema::TABLE => 'custom_value', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'custom_field_id' => 'custom_field_id', 'value' => 'value', ], Schema::RELATIONS => [ 'custom_field' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'customField', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'custom_field_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'custom_field_id' => 'int', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'emailTemplate' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\EmailTemplate', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\EmailTemplate\\EmailTemplateRepository', Schema::DATABASE => 'default', Schema::TABLE => 'email_template', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'email_template_title' => 'email_template_title', 'email_template_type' => 'email_template_type', 'email_template_body' => 'email_template_body', 'email_template_subject' => 'email_template_subject', 'email_template_from_name' => 'email_template_from_name', 'email_template_from_email' => 'email_template_from_email', 'email_template_cc' => 'email_template_cc', 'email_template_bcc' => 'email_template_bcc', 'email_template_pdf_template' => 'email_template_pdf_template', ], Schema::RELATIONS => [], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'family' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\Family', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\Family\\FamilyRepository', Schema::DATABASE => 'default', Schema::TABLE => 'family', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'family_name' => 'family_name', ], Schema::RELATIONS => [], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'gentor' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\Gentor', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\Generator\\GeneratorRepository', Schema::DATABASE => 'default', Schema::TABLE => 'gentor', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'route_prefix' => 'route_prefix', 'route_suffix' => 'route_suffix', 'camelcase_capital_name' => 'camelcase_capital_name', 'small_singular_name' => 'small_singular_name', 'small_plural_name' => 'small_plural_name', 'namespace_path' => 'namespace_path', 'controller_layout_dir' => 'controller_layout_dir', 'controller_layout_dir_dot_path' => 'controller_layout_dir_dot_path', 'repo_extra_camelcase_name' => 'repo_extra_camelcase_name', 'paginator_next_page_attribute' => 'paginator_next_page_attribute', 'constrain_index_field' => 'constrain_index_field', 'filter_field' => 'filter_field', 'filter_field_start_position' => 'filter_field_start_position', 'filter_field_end_position' => 'filter_field_end_position', 'pre_entity_table' => 'pre_entity_table', 'modified_include' => 'modified_include', 'created_include' => 'created_include', 'updated_include' => 'updated_include', 'deleted_include' => 'deleted_include', 'keyset_paginator_include' => 'keyset_paginator_include', 'offset_paginator_include' => 'offset_paginator_include', 'flash_include' => 'flash_include', 'headerline_include' => 'headerline_include', ], Schema::RELATIONS => [], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'filter_field_start_position' => 'int', 'filter_field_end_position' => 'int', 'modified_include' => 'bool', 'created_include' => 'bool', 'updated_include' => 'bool', 'deleted_include' => 'bool', 'keyset_paginator_include' => 'bool', 'offset_paginator_include' => 'bool', 'flash_include' => 'bool', 'headerline_include' => 'bool', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'gentorRelation' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\GentorRelation', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\GeneratorRelation\\GeneratorRelationRepository', Schema::DATABASE => 'default', Schema::TABLE => 'gentor_relation', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'lowercasename' => 'lowercasename', 'camelcasename' => 'camelcasename', 'view_field_name' => 'view_field_name', 'gentor_id' => 'gentor_id', ], Schema::RELATIONS => [ 'gentor' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'gentor', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'gentor_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'gentor_id' => 'int', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'group' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\Group', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\Group\\GroupRepository', Schema::DATABASE => 'default', Schema::TABLE => 'group', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'name' => 'name', 'identifier_format' => 'identifier_format', 'next_id' => 'next_id', 'left_pad' => 'left_pad', ], Schema::RELATIONS => [], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'next_id' => 'int', 'left_pad' => 'int', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'inv' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\Inv', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\Inv\\InvRepository', Schema::DATABASE => 'default', Schema::TABLE => 'inv', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'client_id' => 'client_id', 'group_id' => 'group_id', 'user_id' => 'user_id', 'status_id' => 'status_id', 'is_read_only' => 'is_read_only', 'password' => 'password', 'time_created' => 'time_created', 'date_due' => 'date_due', 'number' => 'number', 'discount_amount' => 'discount_amount', 'discount_percent' => 'discount_percent', 'terms' => 'terms', 'url_key' => 'url_key', 'payment_method' => 'payment_method', 'creditinvoice_parent_id' => 'creditinvoice_parent_id', 'date_created' => 'date_created', 'date_modified' => 'date_modified', ], Schema::RELATIONS => [ 'user' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'user', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'user_id', Relation::OUTER_KEY => ['id'], ], ], 'group' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'group', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => true, Relation::INNER_KEY => 'group_id', Relation::OUTER_KEY => ['id'], ], ], 'client' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'client', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => true, Relation::INNER_KEY => 'client_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'client_id' => 'int', 'group_id' => 'int', 'user_id' => 'int', 'status_id' => 'int', 'is_read_only' => 'bool', 'time_created' => 'datetime', 'date_due' => 'datetime', 'discount_amount' => 'float', 'discount_percent' => 'float', 'payment_method' => 'int', 'creditinvoice_parent_id' => 'int', 'date_created' => 'datetime', 'date_modified' => 'datetime', ], Schema::SCHEMA => [], Schema::LISTENERS => [ [ 'Cycle\\ORM\\Entity\\Behavior\\Listener\\CreatedAt', [ 'field' => 'date_created', ], ], [ 'Cycle\\ORM\\Entity\\Behavior\\Listener\\UpdatedAt', [ 'field' => 'date_modified', 'nullable' => false, ], ], ], Schema::TYPECAST_HANDLER => null, ], 'invAmount' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\InvAmount', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\InvAmount\\InvAmountRepository', Schema::DATABASE => 'default', Schema::TABLE => 'inv_amount', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'inv_id' => 'inv_id', 'sign' => 'sign', 'item_subtotal' => 'item_subtotal', 'item_tax_total' => 'item_tax_total', 'tax_total' => 'tax_total', 'total' => 'total', 'paid' => 'paid', 'balance' => 'balance', ], Schema::RELATIONS => [ 'inv' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'inv', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'inv_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'inv_id' => 'int', 'sign' => 'int', 'item_subtotal' => 'float', 'item_tax_total' => 'float', 'tax_total' => 'float', 'total' => 'float', 'paid' => 'float', 'balance' => 'float', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'invCustom' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\InvCustom', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\InvCustom\\InvCustomRepository', Schema::DATABASE => 'default', Schema::TABLE => 'inv_custom', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'inv_id' => 'inv_id', 'custom_field_id' => 'custom_field_id', 'value' => 'value', ], Schema::RELATIONS => [ 'inv' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'inv', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'inv_id', Relation::OUTER_KEY => ['id'], ], ], 'custom_field' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'customField', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'custom_field_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'inv_id' => 'int', 'custom_field_id' => 'int', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'invItem' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\InvItem', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\InvItem\\InvItemRepository', Schema::DATABASE => 'default', Schema::TABLE => 'inv_item', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'inv_id' => 'inv_id', 'tax_rate_id' => 'tax_rate_id', 'product_id' => 'product_id', 'task_id' => 'task_id', 'date_added' => 'date_added', 'name' => 'name', 'description' => 'description', 'quantity' => 'quantity', 'price' => 'price', 'discount_amount' => 'discount_amount', 'order' => 'order', 'is_recurring' => 'is_recurring', 'product_unit' => 'product_unit', 'product_unit_id' => 'product_unit_id', 'date' => 'date', ], Schema::RELATIONS => [ 'tax_rate' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'taxRate', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'tax_rate_id', Relation::OUTER_KEY => ['id'], ], ], 'product' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'product', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => true, Relation::INNER_KEY => 'product_id', Relation::OUTER_KEY => ['id'], ], ], 'task' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'task', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => true, Relation::INNER_KEY => 'task_id', Relation::OUTER_KEY => ['id'], ], ], 'inv' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'inv', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'inv_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'inv_id' => 'int', 'tax_rate_id' => 'int', 'product_id' => 'int', 'task_id' => 'int', 'date_added' => 'datetime', 'quantity' => 'float', 'price' => 'float', 'discount_amount' => 'float', 'order' => 'int', 'is_recurring' => 'bool', 'product_unit_id' => 'int', 'date' => 'datetime', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'invItemAmount' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\InvItemAmount', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\InvItemAmount\\InvItemAmountRepository', Schema::DATABASE => 'default', Schema::TABLE => 'inv_item_amount', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'inv_item_id' => 'inv_item_id', 'subtotal' => 'subtotal', 'tax_total' => 'tax_total', 'discount' => 'discount', 'total' => 'total', ], Schema::RELATIONS => [ 'inv_item' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'invItem', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'inv_item_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'inv_item_id' => 'int', 'subtotal' => 'float', 'tax_total' => 'float', 'discount' => 'float', 'total' => 'float', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'invRecurring' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\InvRecurring', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\InvRecurring\\InvRecurringRepository', Schema::DATABASE => 'default', Schema::TABLE => 'inv_recurring', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'inv_id' => 'inv_id', 'start' => 'start', 'end' => 'end', 'frequency' => 'frequency', 'next' => 'next', ], Schema::RELATIONS => [ 'inv' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'inv', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'inv_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'inv_id' => 'int', 'start' => 'datetime', 'end' => 'datetime', 'next' => 'datetime', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'invTaxRate' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\InvTaxRate', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\InvTaxRate\\InvTaxRateRepository', Schema::DATABASE => 'default', Schema::TABLE => 'inv_tax_rate', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'inv_id' => 'inv_id', 'tax_rate_id' => 'tax_rate_id', 'include_item_tax' => 'include_item_tax', 'inv_tax_rate_amount' => 'inv_tax_rate_amount', ], Schema::RELATIONS => [ 'inv' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'inv', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'inv_id', Relation::OUTER_KEY => ['id'], ], ], 'tax_rate' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'taxRate', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'tax_rate_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'inv_id' => 'int', 'tax_rate_id' => 'int', 'include_item_tax' => 'int', 'inv_tax_rate_amount' => 'float', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'itemLookup' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\ItemLookup', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\ItemLookup\\ItemLookupRepository', Schema::DATABASE => 'default', Schema::TABLE => 'item_lookup', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'name' => 'name', 'description' => 'description', 'price' => 'price', ], Schema::RELATIONS => [], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'price' => 'float', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'merchant' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\Merchant', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\Merchant\\MerchantRepository', Schema::DATABASE => 'default', Schema::TABLE => 'merchant', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'inv_id' => 'inv_id', 'successful' => 'successful', 'date' => 'date', 'driver' => 'driver', 'response' => 'response', 'reference' => 'reference', ], Schema::RELATIONS => [ 'inv' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'inv', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'inv_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'inv_id' => 'int', 'successful' => 'bool', 'date' => 'datetime', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'payment' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\Payment', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\Payment\\PaymentRepository', Schema::DATABASE => 'default', Schema::TABLE => 'payment', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'payment_method_id' => 'payment_method_id', 'payment_date' => 'payment_date', 'amount' => 'amount', 'note' => 'note', 'inv_id' => 'inv_id', ], Schema::RELATIONS => [ 'inv' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'inv', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'inv_id', Relation::OUTER_KEY => ['id'], ], ], 'payment_method' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'paymentMethod', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'payment_method_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'payment_method_id' => 'int', 'payment_date' => 'datetime', 'amount' => 'float', 'inv_id' => 'int', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'paymentCustom' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\PaymentCustom', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\PaymentCustom\\PaymentCustomRepository', Schema::DATABASE => 'default', Schema::TABLE => 'payment_custom', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'payment_id' => 'payment_id', 'custom_field_id' => 'custom_field_id', 'value' => 'value', ], Schema::RELATIONS => [ 'payment' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'payment', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'payment_id', Relation::OUTER_KEY => ['id'], ], ], 'custom_field' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'customField', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'custom_field_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'payment_id' => 'int', 'custom_field_id' => 'int', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'paymentMethod' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\PaymentMethod', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\PaymentMethod\\PaymentMethodRepository', Schema::DATABASE => 'default', Schema::TABLE => 'payment_method', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'name' => 'name', ], Schema::RELATIONS => [], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'product' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\Product', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\Product\\ProductRepository', Schema::DATABASE => 'default', Schema::TABLE => 'product', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'product_sku' => 'product_sku', 'product_name' => 'product_name', 'product_description' => 'product_description', 'product_price' => 'product_price', 'purchase_price' => 'purchase_price', 'provider_name' => 'provider_name', 'family_id' => 'family_id', 'tax_rate_id' => 'tax_rate_id', 'unit_id' => 'unit_id', 'product_tariff' => 'product_tariff', ], Schema::RELATIONS => [ 'family' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'family', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'family_id', Relation::OUTER_KEY => ['id'], ], ], 'tax_rate' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'taxRate', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'tax_rate_id', Relation::OUTER_KEY => ['id'], ], ], 'unit' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'unit', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'unit_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'product_price' => 'float', 'purchase_price' => 'float', 'family_id' => 'int', 'tax_rate_id' => 'int', 'unit_id' => 'int', 'product_tariff' => 'int', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'productCustom' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\ProductCustom', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\ProductCustom\\ProductCustomRepository', Schema::DATABASE => 'default', Schema::TABLE => 'product_custom', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'product_id' => 'product_id', 'custom_field_id' => 'custom_field_id', 'value' => 'value', ], Schema::RELATIONS => [ 'product' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'product', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'product_id', Relation::OUTER_KEY => ['id'], ], ], 'custom_field' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'customField', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'custom_field_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'product_id' => 'int', 'custom_field_id' => 'int', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'profile' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\Profile', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\Profile\\ProfileRepository', Schema::DATABASE => 'default', Schema::TABLE => 'profile', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'company_id' => 'company_id', 'current' => 'current', 'mobile' => 'mobile', 'email' => 'email', 'description' => 'description', 'date_created' => 'date_created', 'date_modified' => 'date_modified', ], Schema::RELATIONS => [ 'company' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'company', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'company_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'company_id' => 'int', 'current' => 'int', 'date_created' => 'datetime', 'date_modified' => 'datetime', ], Schema::SCHEMA => [], Schema::LISTENERS => [ [ 'Cycle\\ORM\\Entity\\Behavior\\Listener\\UpdatedAt', [ 'field' => 'date_modified', 'nullable' => false, ], ], ], Schema::TYPECAST_HANDLER => null, ], 'project' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\Project', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\Project\\ProjectRepository', Schema::DATABASE => 'default', Schema::TABLE => 'project', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'client_id' => 'client_id', 'name' => 'name', ], Schema::RELATIONS => [ 'client' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'client', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'client_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'client_id' => 'int', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'quote' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\Quote', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\Quote\\QuoteRepository', Schema::DATABASE => 'default', Schema::TABLE => 'quote', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'inv_id' => 'inv_id', 'user_id' => 'user_id', 'client_id' => 'client_id', 'group_id' => 'group_id', 'status_id' => 'status_id', 'date_created' => 'date_created', 'date_modified' => 'date_modified', 'date_expires' => 'date_expires', 'number' => 'number', 'discount_amount' => 'discount_amount', 'discount_percent' => 'discount_percent', 'url_key' => 'url_key', 'password' => 'password', 'notes' => 'notes', ], Schema::RELATIONS => [ 'client' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'client', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => true, Relation::INNER_KEY => 'client_id', Relation::OUTER_KEY => ['id'], ], ], 'group' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'group', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => true, Relation::INNER_KEY => 'group_id', Relation::OUTER_KEY => ['id'], ], ], 'user' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'user', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'user_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'inv_id' => 'int', 'user_id' => 'int', 'client_id' => 'int', 'group_id' => 'int', 'status_id' => 'int', 'date_created' => 'datetime', 'date_modified' => 'datetime', 'date_expires' => 'datetime', 'discount_amount' => 'float', 'discount_percent' => 'float', ], Schema::SCHEMA => [], Schema::LISTENERS => [ [ 'Cycle\\ORM\\Entity\\Behavior\\Listener\\CreatedAt', [ 'field' => 'date_created', ], ], [ 'Cycle\\ORM\\Entity\\Behavior\\Listener\\UpdatedAt', [ 'field' => 'date_modified', 'nullable' => false, ], ], ], Schema::TYPECAST_HANDLER => null, ], 'quoteAmount' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\QuoteAmount', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\QuoteAmount\\QuoteAmountRepository', Schema::DATABASE => 'default', Schema::TABLE => 'quote_amount', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'quote_id' => 'quote_id', 'item_subtotal' => 'item_subtotal', 'item_tax_total' => 'item_tax_total', 'tax_total' => 'tax_total', 'total' => 'total', ], Schema::RELATIONS => [ 'quote' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'quote', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'quote_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'quote_id' => 'int', 'item_subtotal' => 'float', 'item_tax_total' => 'float', 'tax_total' => 'float', 'total' => 'float', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'quoteCustom' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\QuoteCustom', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\QuoteCustom\\QuoteCustomRepository', Schema::DATABASE => 'default', Schema::TABLE => 'quote_custom', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'quote_id' => 'quote_id', 'custom_field_id' => 'custom_field_id', 'value' => 'value', ], Schema::RELATIONS => [ 'custom_field' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'customField', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'custom_field_id', Relation::OUTER_KEY => ['id'], ], ], 'quote' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'quote', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'quote_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'quote_id' => 'int', 'custom_field_id' => 'int', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'quoteItem' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\QuoteItem', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\QuoteItem\\QuoteItemRepository', Schema::DATABASE => 'default', Schema::TABLE => 'quote_item', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'quote_id' => 'quote_id', 'tax_rate_id' => 'tax_rate_id', 'product_id' => 'product_id', 'date_added' => 'date_added', 'name' => 'name', 'description' => 'description', 'quantity' => 'quantity', 'price' => 'price', 'discount_amount' => 'discount_amount', 'order' => 'order', 'product_unit' => 'product_unit', 'product_unit_id' => 'product_unit_id', ], Schema::RELATIONS => [ 'tax_rate' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'taxRate', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'tax_rate_id', Relation::OUTER_KEY => ['id'], ], ], 'product' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'product', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'product_id', Relation::OUTER_KEY => ['id'], ], ], 'quote' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'quote', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'quote_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'quote_id' => 'int', 'tax_rate_id' => 'int', 'product_id' => 'int', 'date_added' => 'datetime', 'quantity' => 'float', 'price' => 'float', 'discount_amount' => 'float', 'order' => 'int', 'product_unit_id' => 'int', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'quoteItemAmount' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\QuoteItemAmount', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\QuoteItemAmount\\QuoteItemAmountRepository', Schema::DATABASE => 'default', Schema::TABLE => 'quote_item_amount', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'quote_item_id' => 'quote_item_id', 'subtotal' => 'subtotal', 'tax_total' => 'tax_total', 'discount' => 'discount', 'total' => 'total', ], Schema::RELATIONS => [ 'quote_item' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'quoteItem', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'quote_item_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'quote_item_id' => 'int', 'subtotal' => 'float', 'tax_total' => 'float', 'discount' => 'float', 'total' => 'float', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'quoteTaxRate' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\QuoteTaxRate', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\QuoteTaxRate\\QuoteTaxRateRepository', Schema::DATABASE => 'default', Schema::TABLE => 'quote_tax_rate', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'quote_id' => 'quote_id', 'tax_rate_id' => 'tax_rate_id', 'include_item_tax' => 'include_item_tax', 'quote_tax_rate_amount' => 'quote_tax_rate_amount', ], Schema::RELATIONS => [ 'quote' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'quote', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'quote_id', Relation::OUTER_KEY => ['id'], ], ], 'tax_rate' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'taxRate', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'tax_rate_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'quote_id' => 'int', 'tax_rate_id' => 'int', 'include_item_tax' => 'int', 'quote_tax_rate_amount' => 'float', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'setting' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\Setting', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\Setting\\SettingRepository', Schema::DATABASE => 'default', Schema::TABLE => 'setting', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'setting_key' => 'setting_key', 'setting_value' => 'setting_value', ], Schema::RELATIONS => [], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'sumex' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\Sumex', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\Sumex\\SumexRepository', Schema::DATABASE => 'default', Schema::TABLE => 'sumex', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'invoice' => 'invoice', 'reason' => 'reason', 'diagnosis' => 'diagnosis', 'observations' => 'observations', 'treatmentstart' => 'treatmentstart', 'treatmentend' => 'treatmentend', 'casedate' => 'casedate', 'casenumber' => 'casenumber', ], Schema::RELATIONS => [], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'invoice' => 'int', 'reason' => 'int', 'treatmentstart' => 'datetime', 'treatmentend' => 'datetime', 'casedate' => 'datetime', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'task' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\Task', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\Task\\TaskRepository', Schema::DATABASE => 'default', Schema::TABLE => 'task', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'project_id' => 'project_id', 'name' => 'name', 'description' => 'description', 'price' => 'price', 'finish_date' => 'finish_date', 'status' => 'status', 'tax_rate_id' => 'tax_rate_id', ], Schema::RELATIONS => [ 'tax_rate' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'taxRate', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'tax_rate_id', Relation::OUTER_KEY => ['id'], ], ], 'project' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'project', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => true, Relation::INNER_KEY => 'project_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'project_id' => 'int', 'price' => 'float', 'finish_date' => 'datetime', 'status' => 'int', 'tax_rate_id' => 'int', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'taxRate' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\TaxRate', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\TaxRate\\TaxRateRepository', Schema::DATABASE => 'default', Schema::TABLE => 'tax_rate', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'tax_rate_name' => 'tax_rate_name', 'tax_rate_percent' => 'tax_rate_percent', 'tax_rate_default' => 'tax_rate_default', ], Schema::RELATIONS => [], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'tax_rate_percent' => 'float', 'tax_rate_default' => 'bool', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'unit' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\Unit', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\Unit\\UnitRepository', Schema::DATABASE => 'default', Schema::TABLE => 'unit', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'unit_name' => 'unit_name', 'unit_name_plrl' => 'unit_name_plrl', ], Schema::RELATIONS => [], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'userClient' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\UserClient', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\UserClient\\UserClientRepository', Schema::DATABASE => 'default', Schema::TABLE => 'user_client', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'user_id' => 'user_id', 'client_id' => 'client_id', ], Schema::RELATIONS => [ 'user' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'user', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'user_id', Relation::OUTER_KEY => ['id'], ], ], 'client' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'client', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'client_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'user_id' => 'int', 'client_id' => 'int', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'userCustom' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\UserCustom', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\UserCustom\\UserCustomRepository', Schema::DATABASE => 'default', Schema::TABLE => 'user_custom', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'user_id' => 'user_id', 'fieldid' => 'fieldid', 'fieldvalue' => 'fieldvalue', ], Schema::RELATIONS => [ 'user' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'user', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'user_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'user_id' => 'int', 'fieldid' => 'int', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], 'userInv' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\UserInv', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\UserInv\\UserInvRepository', Schema::DATABASE => 'default', Schema::TABLE => 'user_inv', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'user_id' => 'user_id', 'type' => 'type', 'active' => 'active', 'date_created' => 'date_created', 'date_modified' => 'date_modified', 'language' => 'language', 'name' => 'name', 'company' => 'company', 'address_1' => 'address_1', 'address_2' => 'address_2', 'city' => 'city', 'state' => 'state', 'zip' => 'zip', 'country' => 'country', 'phone' => 'phone', 'fax' => 'fax', 'mobile' => 'mobile', 'email' => 'email', 'password' => 'password', 'web' => 'web', 'vat_id' => 'vat_id', 'tax_code' => 'tax_code', 'all_clients' => 'all_clients', 'salt' => 'salt', 'passwordreset_token' => 'passwordreset_token', 'subscribernumber' => 'subscribernumber', 'iban' => 'iban', 'gln' => 'gln', 'rcc' => 'rcc', ], Schema::RELATIONS => [ 'user' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'user', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'user_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'user_id' => 'int', 'type' => 'int', 'active' => 'bool', 'date_created' => 'datetime', 'date_modified' => 'datetime', 'all_clients' => 'bool', 'gln' => 'int', ], Schema::SCHEMA => [], Schema::LISTENERS => [ [ 'Cycle\\ORM\\Entity\\Behavior\\Listener\\CreatedAt', [ 'field' => 'date_created', ], ], [ 'Cycle\\ORM\\Entity\\Behavior\\Listener\\UpdatedAt', [ 'field' => 'date_modified', 'nullable' => false, ], ], ], Schema::TYPECAST_HANDLER => null, ], 'user' => [ Schema::ENTITY => 'App\\User\\User', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\User\\UserRepository', Schema::DATABASE => 'default', Schema::TABLE => 'user', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'login' => 'login', 'passwordHash' => 'password_hash', 'created_at' => 'created_at', 'updated_at' => 'updated_at', ], Schema::RELATIONS => [ 'identity' => [ Relation::TYPE => Relation::HAS_ONE, Relation::TARGET => 'identity', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => ['id'], Relation::OUTER_KEY => 'user_id', ], ], 'posts' => [ Relation::TYPE => Relation::HAS_MANY, Relation::TARGET => 'post', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::WHERE => [], Relation::ORDER_BY => [], Relation::INNER_KEY => ['id'], Relation::OUTER_KEY => 'user_id', '4' => null, ], ], 'comments' => [ Relation::TYPE => Relation::HAS_MANY, Relation::TARGET => 'comment', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::WHERE => [], Relation::ORDER_BY => [], Relation::INNER_KEY => ['id'], Relation::OUTER_KEY => 'user_id', '4' => null, ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'created_at' => 'datetime', 'updated_at' => 'datetime', ], Schema::SCHEMA => [], Schema::LISTENERS => [ [ 'Cycle\\ORM\\Entity\\Behavior\\Listener\\CreatedAt', [ 'field' => 'created_at', ], ], [ 'Cycle\\ORM\\Entity\\Behavior\\Listener\\UpdatedAt', [ 'field' => 'updated_at', 'nullable' => false, ], ], ], Schema::TYPECAST_HANDLER => null, ], ]; ```
rossaddison commented 2 years ago

Specifically the product schema table:

```php 'product' => [ Schema::ENTITY => 'App\\Invoice\\Entity\\Product', Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper', Schema::SOURCE => 'Cycle\\ORM\\Select\\Source', Schema::REPOSITORY => 'App\\Invoice\\Product\\ProductRepository', Schema::DATABASE => 'default', Schema::TABLE => 'product', Schema::PRIMARY_KEY => ['id'], Schema::FIND_BY_KEYS => ['id'], Schema::COLUMNS => [ 'id' => 'id', 'product_sku' => 'product_sku', 'product_name' => 'product_name', 'product_description' => 'product_description', 'product_price' => 'product_price', 'purchase_price' => 'purchase_price', 'provider_name' => 'provider_name', 'family_id' => 'family_id', 'tax_rate_id' => 'tax_rate_id', 'unit_id' => 'unit_id', 'product_tariff' => 'product_tariff', ], Schema::RELATIONS => [ 'family' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'family', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'family_id', Relation::OUTER_KEY => ['id'], ], ], 'tax_rate' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'taxRate', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'tax_rate_id', Relation::OUTER_KEY => ['id'], ], ], 'unit' => [ Relation::TYPE => Relation::BELONGS_TO, Relation::TARGET => 'unit', Relation::LOAD => Relation::LOAD_PROMISE, Relation::SCHEMA => [ Relation::CASCADE => true, Relation::NULLABLE => false, Relation::INNER_KEY => 'unit_id', Relation::OUTER_KEY => ['id'], ], ], ], Schema::SCOPE => null, Schema::TYPECAST => [ 'id' => 'int', 'product_price' => 'float', 'purchase_price' => 'float', 'family_id' => 'int', 'tax_rate_id' => 'int', 'unit_id' => 'int', 'product_tariff' => 'int', ], Schema::SCHEMA => [], Schema::TYPECAST_HANDLER => null, ], ```
roxblnfk commented 2 years ago

Schema looks OK. I was expecting a slightly different result from the inner/outer keys generator.

Can you dump the entity before edit and after edit (before save)? Needed fields: $tax_rate_id and $tax_rate

rossaddison commented 2 years ago

This is a schema which I have pulled from rossaddison/yii-invoice which is a fork of yiisoft/demo. Specifically from

runtime/schema.php generated by the rossaddison/yii-invoice fork once it is running as a result of using config/params.php

'schema-providers' => [
            // Uncomment next line to enable a Schema caching in the common cache
            //\Yiisoft\Yii\Cycle\Schema\Provider\SimpleCacheSchemaProvider::class => ['key' => 'cycle-orm-cache-key'],

            // Store generated Schema in the file
            \Yiisoft\Yii\Cycle\Schema\Provider\PhpFileSchemaProvider::class => [
               'mode' => \Yiisoft\Yii\Cycle\Schema\Provider\PhpFileSchemaProvider::MODE_READ_AND_WRITE,
               'file' => 'runtime/schema.php',
            ],

            ////\Yiisoft\Yii\Cycle\Schema\Provider\FromConveyorSchemaProvider::class => [
            ////    'generators' => [
            ////         Cycle\Schema\Generator\SyncTables::class, // sync table changes to database
            ////    ],
            ////],
        ],

I was not sure how to initialize the schema using the https://github.com/cycle/schema-renderer, specifically the details between the square brackets.

$schema = new Schema([...]);

Yii does the schema.php at runtime so I chose the above by simply copying the file from my runtime folder but I would still like to know how to do it through Cycle.

rossaddison commented 2 years ago

Yes I believe the outer key should be without the square brackets ie. id and not [id] so that when it is joined with the relation tax_rate it creates the complete key tax_rate_id but that is just my mind and I have not walked through the code yet.

rossaddison commented 2 years ago

How do I dump the entity?

TiaNex-Com commented 2 years ago

$model->setTax_rate_id((int)$form->getTax_rate_id());

i mean try to change $model->setTax_rate_id((int)$form->getTax_rate_id());

to $model->setTax_rate( Tax_rate ); to establish the relations

roxblnfk commented 2 years ago
$schema = new Schema([...]);

Yii does the schema.php at runtime so I chose the above by simply copying the file from my runtime folder but I would still like to know how to do it through Cycle.

It's OK. Yii3 uses the cycle/schema-renderer package to generate schema.php in schema-file-cache. You can use these commands to render the Cycle Schema - they also use cycle/schema-renderer

rossaddison commented 2 years ago

Ok, ran C:\wamp64\www\yii-invoice>yii cycle/schema and got the following.

[product] :: default.product
       Entity: App\Invoice\Entity\Product
       Mapper: Cycle\ORM\Mapper\Mapper
   Repository: App\Invoice\Product\ProductRepository
  Primary key: id
       Fields:
               (property -> db.field -> typecast)
               id -> id -> int
               product_sku -> product_sku
               product_name -> product_name
               product_description -> product_description
               product_price -> product_price -> float
               purchase_price -> purchase_price -> float
               provider_name -> provider_name
               family_id -> family_id -> int
               tax_rate_id -> tax_rate_id -> int
               unit_id -> unit_id -> int
               product_tariff -> product_tariff -> int
    Relations:
     product->family belongs to family, lazy loading, cascaded
       not null product.family_id <==> family.id
     product->tax_rate belongs to taxRate, lazy loading, cascaded
       not null product.tax_rate_id <==> taxRate.id
     product->unit belongs to unit, lazy loading, cascaded
       not null product.unit_id <==> unit.id
roxblnfk commented 2 years ago

Yes I believe the outer key should be without the square brackets ie. id and not [id] so that when it is joined with the relation tax_rate it creates the complete key tax_rate_id but that is just my mind and I have not walked through the code yet.

There PhpFileSchemaProvider generator configured to read (like cache) and write schema. By the reason you can modify schema.php manually to test your assumptions.

Also you should turn on the FromConveyorSchemaProvider to generate new Schema based on attributes if Schema cache is clear.

'schema-providers' => [
            // Uncomment next line to enable a Schema caching in the common cache
            //\Yiisoft\Yii\Cycle\Schema\Provider\SimpleCacheSchemaProvider::class => ['key' => 'cycle-orm-cache-key'],

            // Store generated Schema in the file
            \Yiisoft\Yii\Cycle\Schema\Provider\PhpFileSchemaProvider::class => [
               'mode' => \Yiisoft\Yii\Cycle\Schema\Provider\PhpFileSchemaProvider::MODE_READ_AND_WRITE,
               'file' => 'runtime/schema.php',
            ],

            \Yiisoft\Yii\Cycle\Schema\Provider\FromConveyorSchemaProvider::class => [
                'generators' => [
            //         Cycle\Schema\Generator\SyncTables::class, // sync table changes to database
                ],
            ],
        ],
roxblnfk commented 2 years ago

Ok, ran C:\wamp64\www\yii-invoice>yii cycle/schema and got the following.

Schema looks OK. We need to dump the Entity before changing and after it (before save).

roxblnfk commented 2 years ago

service

public function saveProduct(Product $model, ProductForm $form): void
    {
        dump($model);  // <<< HERE

        $model->setProduct_sku($form->getProduct_sku());
        $model->setProduct_name($form->getProduct_name());
        $model->setProduct_description($form->getProduct_description());
        $model->setProduct_price($form->getProduct_price());
        $model->setPurchase_price($form->getPurchase_price());
        $model->setProvider_name($form->getProvider_name());
        $model->setProduct_tariff($form->getProduct_tariff()); 
        $model->setTax_rate_id((int)$form->getTax_rate_id());
        $model->setUnit_id((int)$form->getUnit_id());
        $model->setFamily_id((int)$form->getFamily_id());

        dump($model);  // <<< AND HERE

        $this->repository->save($model);
    }
rossaddison commented 2 years ago

$dump_before

object(App\Invoice\Entity\Product Cycle ORM Proxy)#2611 (14) { 
["id":"App\Invoice\Entity\Product":private]=> int(3) 
["product_sku":"App\Invoice\Entity\Product":private]=> string(12) "dfghdfghdfgh" 
["product_name":"App\Invoice\Entity\Product":private]=> string(15) "Window Cleaning" 
["product_description":"App\Invoice\Entity\Product":private]=> string(7) "fasdfaf" 
["product_price":"App\Invoice\Entity\Product":private]=> float(15) 
["purchase_price":"App\Invoice\Entity\Product":private]=> float(7) 
["provider_name":"App\Invoice\Entity\Product":private]=> string(0) "" 

["family":"App\Invoice\Entity\Product":private]=> object(App\Invoice\Entity\Family Cycle ORM Proxy)#2614 (2) {    
["id"]=> int(1)                                                               //  1

["family_name"]=> string(7) "Product" } 

["family_id":"App\Invoice\Entity\Product":private]=> int(1)     // 2

["tax_rate":"App\Invoice\Entity\Product":private]=> object(App\Invoice\Entity\TaxRate Cycle ORM Proxy)#2622 (4) { 
["id":"App\Invoice\Entity\TaxRate":private]=> int(2)                // 3

["tax_rate_name":"App\Invoice\Entity\TaxRate":private]=> string(8) "Standard" 
["tax_rate_percent":"App\Invoice\Entity\TaxRate":private]=> float(20) 
["tax_rate_default":"App\Invoice\Entity\TaxRate":private]=> bool(true) } 

["tax_rate_id":"App\Invoice\Entity\Product":private]=> int(2)        // 4

["unit":"App\Invoice\Entity\Product":private]=> object(App\Invoice\Entity\Unit Cycle ORM Proxy)#2624 (3) { 
["id"]=> int(3) ["unit_name":"App\Invoice\Entity\Unit":private]=> string(10) "Third Unit"   //  5 

["unit_name_plrl":"App\Invoice\Entity\Unit":private]=> string(11) "Third units" } 

["unit_id":"App\Invoice\Entity\Product":private]=> int(3)                   // 6

["product_tariff":"App\Invoice\Entity\Product":private]=> int(2) }

$dump_after

object(App\Invoice\Entity\Product Cycle ORM Proxy)#2611 (14) {
["id":"App\Invoice\Entity\Product":private]=> int(3) 
["product_sku":"App\Invoice\Entity\Product":private]=> string(12) "dfghdfghdfgh" 
["product_name":"App\Invoice\Entity\Product":private]=> string(15) "Window Cleaning" 
["product_description":"App\Invoice\Entity\Product":private]=> string(7) "fasdfaf" 
["product_price":"App\Invoice\Entity\Product":private]=> float(15) 
["purchase_price":"App\Invoice\Entity\Product":private]=> float(7) 
["provider_name":"App\Invoice\Entity\Product":private]=> string(0) "" 
["family":"App\Invoice\Entity\Product":private]=> object(App\Invoice\Entity\Family Cycle ORM Proxy)#2614 (2) { 

["id"]=> int(1)                                                               // 7

["family_name"]=> string(7) "Product" } 

["family_id":"App\Invoice\Entity\Product":private]=> int(2)     // 8

["tax_rate":"App\Invoice\Entity\Product":private]=> object(App\Invoice\Entity\TaxRate Cycle ORM Proxy)#2622 (4) { 

["id":"App\Invoice\Entity\TaxRate":private]=> int(2)                // 9

["tax_rate_name":"App\Invoice\Entity\TaxRate":private]=> string(8) "Standard" 
["tax_rate_percent":"App\Invoice\Entity\TaxRate":private]=> float(20) 
["tax_rate_default":"App\Invoice\Entity\TaxRate":private]=> bool(true) } 

["tax_rate_id":"App\Invoice\Entity\Product":private]=> int(1)       // 10

["unit":"App\Invoice\Entity\Product":private]=> object(App\Invoice\Entity\Unit Cycle ORM Proxy)#2624 (3) { 

["id"]=> int(3) ["unit_name":"App\Invoice\Entity\Unit":private]=> string(10) "Third Unit"   // 11

["unit_name_plrl":"App\Invoice\Entity\Unit":private]=> string(11) "Third units" } 

["unit_id":"App\Invoice\Entity\Product":private]=> int(1)     // 12

["product_tariff":"App\Invoice\Entity\Product":private]=> int(2) }
rossaddison commented 2 years ago

Using service:

 public function saveProduct(Product $model, ProductForm $form): string
    {
        $dump_before = var_dump($model);

        $model->setProduct_sku($form->getProduct_sku());
        $model->setProduct_name($form->getProduct_name());
        $model->setProduct_description($form->getProduct_description());
        $model->setProduct_price($form->getProduct_price());
        $model->setPurchase_price($form->getPurchase_price());
        $model->setProvider_name($form->getProvider_name());
        $model->setProduct_tariff($form->getProduct_tariff()); 
        $model->setTax_rate_id((int)$form->getTax_rate_id());
        $model->setUnit_id((int)$form->getUnit_id());
        $model->setFamily_id((int)$form->getFamily_id());  

        $dump_after = var_dump($model);

        $this->repository->save($model);

        return $dump_before.$dump_after;
    }

Controller:

 if ($form->load($body) && $validator->validate($form)->isValid()) {
                $dump = $this->productService->saveProduct($this->product($currentRoute, $pR), $form);  
                $this->flash('info', $dump);
                return $this->webService->getRedirectResponse('product/index');   
            }
rossaddison commented 2 years ago

I only changed the relation keys ie.

dropdown for family changed from Product to Service, ie. family_id changed from 1 to 2. dropdown for tax_rate changed from Standard to Zero, ie. tax_rate_id changed from 2 to 1. dropdown for unit changed from unit/units to clean/cleans ie. unit_id changed from 3 to 1.

The id's for all of the above are being correctly changed by the form and service.

roxblnfk commented 2 years ago

The service changes related entities ids in the Product but previous entities already loaded. Before save the Product entity has inconsistent state:

Can you try to make it consistent before save? I mean to unset related entities or set new related like

$product->tax_rate = $taxRate_with_id3;
rossaddison commented 2 years ago

Please can you use the forward slashes like // with a number after it eg. // 8 that I have put in the $dump_before and $dump_after at the end of each line in your comment above to understand you correctly.

roxblnfk commented 2 years ago

image

rossaddison commented 2 years ago

Sorry for being pedantic / picky/ fussy but I think you have a typo in your comment:

it has TaxRate parent with id=1 and tax_rate_id=2

these should be <=> swopped.

rossaddison commented 2 years ago

I included the following into the Service and Entitys to resolve this problem basically providing setRelation functions to balance the getRelation functions. It just means we can initialize these to null before the product is saved.

Service

 public function editProduct(Product $model, ProductForm $form): string
    {
        $dump_before = var_dump($model);

        $model->setProduct_sku($form->getProduct_sku());
        $model->setProduct_name($form->getProduct_name());
        $model->setProduct_description($form->getProduct_description());
        $model->setProduct_price($form->getProduct_price());
        $model->setPurchase_price($form->getPurchase_price());
        $model->setProvider_name($form->getProvider_name());
        $model->setProduct_tariff($form->getProduct_tariff());
        null!==$form->getTax_rate_id() ? $model->setTaxrate($model->getTaxrate()->getTax_rate_id() == $form->getTax_rate_id() ? $model->getTaxrate() : null): '';
        $model->setTax_rate_id((int)$form->getTax_rate_id());       
        null!==$form->getUnit_id() ? $model->setUnit($model->getUnit()->getUnit_id() == $form->getUnit_id() ? $model->getUnit() : null) : '';
        $model->setUnit_id((int)$form->getUnit_id());
        null!== $form->getFamily_id() ?$model->setFamily($model->getFamily()->getFamily_id() == $form->getFamily_id() ? $model->getFamily() : null) : '';
        $model->setFamily_id((int)$form->getFamily_id());

        $dump_after = var_dump($model);

        $this->repository->save($model);

        return $dump_before.$dump_after;
    }

    public function addProduct(Product $model, ProductForm $form): void
    {
        $model->setProduct_sku($form->getProduct_sku());
        $model->setProduct_name($form->getProduct_name());
        $model->setProduct_description($form->getProduct_description());
        $model->setProduct_price($form->getProduct_price());
        $model->setPurchase_price($form->getPurchase_price());
        $model->setProvider_name($form->getProvider_name());
        $model->setProduct_tariff($form->getProduct_tariff());        
        $model->setTax_rate_id((int)$form->getTax_rate_id());               
        $model->setUnit_id((int)$form->getUnit_id());
        $model->setFamily_id((int)$form->getFamily_id());
        $this->repository->save($model);
    }

Entity

  //get relation $family
    public function getFamily(): ?Family
    {
        return $this->family;
    }

    //set relation $family
    public function setFamily(?Family $family): void
    {
        $this->family = $family;
    }

    //relation $tax_rate
    public function getTaxrate(): ?TaxRate
    {
        return $this->tax_rate;
    }

    //set relation $taxrate
    public function setTaxrate(?TaxRate $taxrate): void
    {
        $this->tax_rate = $taxrate;
    }

    //relation $unit
    public function getUnit(): ?Unit
    {
        return $this->unit;
    }

    //set relation $unit
    public function setUnit(?Unit $unit): void
    {
        $this->unit = $unit;
    }
rossaddison commented 2 years ago

Ok the relations are saving now but new items added are experiencing an error. This is not going to be a quick solution. I have decided to create two separate functions in the service. One for adding and one for editing. This has solved my problem.

I will leave this open for a while just in case. Nevertheless, thanks a million for your help roxblnfk. Thank you for your willingness and determination.

rossaddison commented 1 year ago

Further reading: Here