Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
.idea/
vendor
composer.lock

4 changes: 2 additions & 2 deletions AbstractTestSuite.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

require_once dirname(__FILE__) . '/sfTimer.php';
require_once __DIR__ . '/sfTimer.php';

abstract class AbstractTestSuite
{
Expand Down Expand Up @@ -127,7 +127,7 @@ public function assertEquals($expected, $actual, $message = null) {

public function assertNotNull($actual, $message = null) {
if (null == $actual) {
throw new Exception($message ?? sprintf('%s is null', $actual));
throw new Exception($message ?? sprintf('%s is null or zero', $actual));
}
}
}
7 changes: 7 additions & 0 deletions PHPFUI_ORM/App/Record/Category.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace App\Record;

class Category extends \App\Record\Definition\Category
{
}
36 changes: 36 additions & 0 deletions PHPFUI_ORM/App/Record/Definition/Category.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace App\Record\Definition;

/**
* Autogenerated. Do not modify. Modify SQL table, then generate with \PHPFUI\ORM\Tool\Generate\CRUD class.
*
* @property int $category_id MySQL type integer
* @property \App\Record\Category $category related record
* @property string $name MySQL type varchar(128)
*/
abstract class Category extends \PHPFUI\ORM\Record
{
protected static bool $autoIncrement = true;

/** @var array<string, \PHPFUI\ORM\FieldDefinition> */
protected static array $fields = [];

/** @var array<string> */
protected static array $primaryKeys = ['category_id', ];

protected static string $table = 'category';

public function initFieldDefinitions() : static
{
if (! count(static::$fields))
{
static::$fields = [
'category_id' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, false, ),
'name' => new \PHPFUI\ORM\FieldDefinition('varchar(128)', 'string', 128, false, ),
];
}

return $this;
}
}
40 changes: 40 additions & 0 deletions PHPFUI_ORM/App/Record/Definition/Image.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace App\Record\Definition;

/**
* Autogenerated. Do not modify. Modify SQL table, then generate with \PHPFUI\ORM\Tool\Generate\CRUD class.
*
* @property int $image_id MySQL type integer
* @property \App\Record\Image $image related record
* @property ?int $imageable_id MySQL type integer
* @property ?string $imageable_type MySQL type varchar(128)
* @property string $path MySQL type varchar(128)
*/
abstract class Image extends \PHPFUI\ORM\Record
{
protected static bool $autoIncrement = true;

/** @var array<string, \PHPFUI\ORM\FieldDefinition> */
protected static array $fields = [];

/** @var array<string> */
protected static array $primaryKeys = ['image_id', ];

protected static string $table = 'image';

public function initFieldDefinitions() : static
{
if (! count(static::$fields))
{
static::$fields = [
'image_id' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, false, ),
'imageable_id' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, true, ),
'imageable_type' => new \PHPFUI\ORM\FieldDefinition('varchar(128)', 'string', 128, true, ),
'path' => new \PHPFUI\ORM\FieldDefinition('varchar(128)', 'string', 128, false, ),
];
}

return $this;
}
}
43 changes: 43 additions & 0 deletions PHPFUI_ORM/App/Record/Definition/Product.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

namespace App\Record\Definition;

/**
* Autogenerated. Do not modify. Modify SQL table, then generate with \PHPFUI\ORM\Tool\Generate\CRUD class.
*
* @property ?int $category_id MySQL type integer
* @property \App\Record\Category $category related record
* @property string $name MySQL type varchar(255)
* @property ?float $price MySQL type float
* @property int $product_id MySQL type integer
* @property \App\Record\Product $product related record
* @property string $sku MySQL type varchar(24)
*/
abstract class Product extends \PHPFUI\ORM\Record
{
protected static bool $autoIncrement = true;

/** @var array<string, \PHPFUI\ORM\FieldDefinition> */
protected static array $fields = [];

/** @var array<string> */
protected static array $primaryKeys = ['product_id', ];

protected static string $table = 'product';

public function initFieldDefinitions() : static
{
if (! count(static::$fields))
{
static::$fields = [
'category_id' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, true, ),
'name' => new \PHPFUI\ORM\FieldDefinition('varchar(255)', 'string', 255, false, ),
'price' => new \PHPFUI\ORM\FieldDefinition('float', 'float', 0, true, ),
'product_id' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, false, ),
'sku' => new \PHPFUI\ORM\FieldDefinition('varchar(24)', 'string', 24, false, ),
];
}

return $this;
}
}
42 changes: 42 additions & 0 deletions PHPFUI_ORM/App/Record/Definition/ProductTag.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace App\Record\Definition;

/**
* Autogenerated. Do not modify. Modify SQL table, then generate with \PHPFUI\ORM\Tool\Generate\CRUD class.
*
* @property ?int $position MySQL type integer
* @property ?int $product_id MySQL type integer
* @property \App\Record\Product $product related record
* @property int $product_tag_id MySQL type integer
* @property \App\Record\ProductTag $product_tag related record
* @property ?int $tag_id MySQL type integer
* @property \App\Record\Tag $tag related record
*/
abstract class ProductTag extends \PHPFUI\ORM\Record
{
protected static bool $autoIncrement = true;

/** @var array<string, \PHPFUI\ORM\FieldDefinition> */
protected static array $fields = [];

/** @var array<string> */
protected static array $primaryKeys = ['product_tag_id', ];

protected static string $table = 'product_tag';

public function initFieldDefinitions() : static
{
if (! count(static::$fields))
{
static::$fields = [
'position' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, true, ),
'product_id' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, true, ),
'product_tag_id' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, false, ),
'tag_id' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, true, ),
];
}

return $this;
}
}
36 changes: 36 additions & 0 deletions PHPFUI_ORM/App/Record/Definition/Tag.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace App\Record\Definition;

/**
* Autogenerated. Do not modify. Modify SQL table, then generate with \PHPFUI\ORM\Tool\Generate\CRUD class.
*
* @property string $name MySQL type varchar(128)
* @property int $tag_id MySQL type integer
* @property \App\Record\Tag $tag related record
*/
abstract class Tag extends \PHPFUI\ORM\Record
{
protected static bool $autoIncrement = true;

/** @var array<string, \PHPFUI\ORM\FieldDefinition> */
protected static array $fields = [];

/** @var array<string> */
protected static array $primaryKeys = ['tag_id', ];

protected static string $table = 'tag';

public function initFieldDefinitions() : static
{
if (! count(static::$fields))
{
static::$fields = [
'name' => new \PHPFUI\ORM\FieldDefinition('varchar(128)', 'string', 128, false, ),
'tag_id' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, false, ),
];
}

return $this;
}
}
7 changes: 7 additions & 0 deletions PHPFUI_ORM/App/Record/Image.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace App\Record;

class Image extends \App\Record\Definition\Image
{
}
11 changes: 11 additions & 0 deletions PHPFUI_ORM/App/Record/Product.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace App\Record;

class Product extends \App\Record\Definition\Product
{
protected static array $virtualFields = [
'tags' => [\PHPFUI\ORM\ManyToMany::class, \App\Table\ProductTag::class, \App\Table\Tag::class, 'position'],
'images' => [\PHPFUI\ORM\MorphMany::class, \App\Table\Image::class, 'imageable', ],
];
}
7 changes: 7 additions & 0 deletions PHPFUI_ORM/App/Record/ProductTag.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace App\Record;

class ProductTag extends \App\Record\Definition\ProductTag
{
}
7 changes: 7 additions & 0 deletions PHPFUI_ORM/App/Record/Tag.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace App\Record;

class Tag extends \App\Record\Definition\Tag
{
}
8 changes: 8 additions & 0 deletions PHPFUI_ORM/App/Table/Category.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace App\Table;

class Category extends \PHPFUI\ORM\Table
{
protected static string $className = \App\Record\Category::class;
}
8 changes: 8 additions & 0 deletions PHPFUI_ORM/App/Table/Image.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace App\Table;

class Image extends \PHPFUI\ORM\Table
{
protected static string $className = \App\Record\Image::class;
}
8 changes: 8 additions & 0 deletions PHPFUI_ORM/App/Table/Product.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace App\Table;

class Product extends \PHPFUI\ORM\Table
{
protected static string $className = \App\Record\Product::class;
}
8 changes: 8 additions & 0 deletions PHPFUI_ORM/App/Table/ProductTag.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace App\Table;

class ProductTag extends \PHPFUI\ORM\Table
{
protected static string $className = \App\Record\ProductTag::class;
}
8 changes: 8 additions & 0 deletions PHPFUI_ORM/App/Table/Tag.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace App\Table;

class Tag extends \PHPFUI\ORM\Table
{
protected static string $className = \App\Record\Tag::class;
}
Loading