Advertisement
Guest User

Untitled

a guest
Dec 23rd, 2020
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.72 KB | None | 0 0
  1. <?php
  2.  
  3. declare(strict_types=1);
  4.  
  5. use Cycle\ORM\Schema;
  6. use Cycle\ORM\Relation;
  7. use Cycle\Schema\Relation\RelationSchema;
  8.  
  9. return [
  10.     'user' => [
  11.         Schema::DATABASE => 'default',
  12.         Schema::TABLE => 'user',
  13.         Schema::ENTITY => 'App\\Entity\\User',
  14.         Schema::MAPPER => 'Yiisoft\\Yii\\Cycle\\Mapper\\TimestampedMapper',
  15.         Schema::REPOSITORY => 'App\\User\\UserRepository',
  16.         Schema::CONSTRAIN => null,
  17.         Schema::PRIMARY_KEY => 'id',
  18.         Schema::COLUMNS => [
  19.             'id' => 'id',
  20.             'login' => 'login',
  21.             'passwordHash' => 'password_hash',
  22.             'passwordResetToken' => 'password_reset_token',
  23.             'emailVerificationToken' => 'email_verification_token',
  24.             'email' => 'email',
  25.             'emailVerified' => 'email_verified',
  26.             'created_at' => 'created_at',
  27.             'updated_at' => 'updated_at',
  28.         ],
  29.         Schema::TYPECAST => [
  30.             'id' => 'int',
  31.             'emailVerified' => 'bool',
  32.             'created_at' => 'datetime',
  33.             'updated_at' => 'datetime',
  34.         ],
  35.         Schema::RELATIONS => [
  36.             'name' => [
  37.                 Relation::TYPE => 1,
  38.                 Relation::TARGET => 'user:name',
  39.                 Relation::LOAD => Relation::LOAD_EAGER,
  40.                 Relation::SCHEMA => [],
  41.             ],
  42.             'accounts' => [
  43.                 Relation::TYPE => Relation::HAS_MANY,
  44.                 Relation::TARGET => 'account',
  45.                 Relation::LOAD => Relation::LOAD_PROMISE,
  46.                 Relation::SCHEMA => [
  47.                     Relation::CASCADE => true,
  48.                     Relation::NULLABLE => false,
  49.                     Relation::WHERE => [],
  50.                     Relation::INNER_KEY => 'id',
  51.                     Relation::OUTER_KEY => 'user_id',
  52.                 ],
  53.             ],
  54.         ],
  55.     ],
  56.     'account' => [
  57.         Schema::DATABASE => 'default',
  58.         Schema::TABLE => 'account',
  59.         Schema::ENTITY => 'App\\Entity\\Account',
  60.         Schema::MAPPER => 'Yiisoft\\Yii\\Cycle\\Mapper\\TimestampedMapper',
  61.         Schema::REPOSITORY => 'App\\Account\\AccountRepository',
  62.         Schema::CONSTRAIN => null,
  63.         Schema::PRIMARY_KEY => 'id',
  64.         Schema::COLUMNS => [
  65.             'id' => 'id',
  66.             'name' => 'name',
  67.             'type' => 'type',
  68.             'active' => 'active',
  69.             'created_at' => 'created_at',
  70.             'updated_at' => 'updated_at',
  71.             'user_id' => 'user_id',
  72.         ],
  73.         Schema::TYPECAST => [
  74.             'id' => 'int',
  75.             'active' => 'bool',
  76.             'created_at' => 'datetime',
  77.             'updated_at' => 'datetime',
  78.             'user_id' => 'int',
  79.         ],
  80.         Schema::RELATIONS => [
  81.             'balance' => [
  82.                 Relation::TYPE => 1,
  83.                 Relation::TARGET => 'account:money',
  84.                 Relation::LOAD => Relation::LOAD_EAGER,
  85.                 Relation::SCHEMA => [],
  86.             ],
  87.             'user' => [
  88.                 Relation::TYPE => Relation::BELONGS_TO,
  89.                 Relation::TARGET => 'user',
  90.                 Relation::LOAD => Relation::LOAD_PROMISE,
  91.                 Relation::SCHEMA => [
  92.                     Relation::CASCADE => true,
  93.                     Relation::NULLABLE => false,
  94.                     Relation::INNER_KEY => 'user_id',
  95.                     Relation::OUTER_KEY => 'id',
  96.                 ],
  97.             ],
  98.         ],
  99.     ],
  100.     'user:name' => [
  101.         Schema::DATABASE => 'default',
  102.         Schema::TABLE => 'user',
  103.         Schema::ENTITY => 'App\\Entity\\Name',
  104.         Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper',
  105.         Schema::REPOSITORY => 'Cycle\\ORM\\Select\\Repository',
  106.         Schema::CONSTRAIN => null,
  107.         Schema::PRIMARY_KEY => 'id',
  108.         Schema::COLUMNS => [
  109.             'firstname' => 'firstname',
  110.             'middle' => 'middle',
  111.             'lastname' => 'lastname',
  112.             'id' => 'id',
  113.         ],
  114.         Schema::TYPECAST => [
  115.             'id' => 'int',
  116.         ],
  117.         Schema::RELATIONS => [],
  118.     ],
  119.     'account:money' => [
  120.         Schema::DATABASE => 'default',
  121.         Schema::TABLE => 'account',
  122.         Schema::ENTITY => 'App\\Entity\\Money',
  123.         Schema::MAPPER => 'Cycle\\ORM\\Mapper\\Mapper',
  124.         Schema::REPOSITORY => 'Cycle\\ORM\\Select\\Repository',
  125.         Schema::CONSTRAIN => null,
  126.         Schema::PRIMARY_KEY => 'id',
  127.         Schema::COLUMNS => [
  128.             'balance' => 'balance',
  129.             'currencyCode' => 'currency_code',
  130.             'id' => 'id',
  131.         ],
  132.         Schema::TYPECAST => [
  133.             'balance' => 'int',
  134.             'id' => 'int',
  135.         ],
  136.         Schema::RELATIONS => [],
  137.     ],
  138. ];
  139.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement