Skip to content

Commit

Permalink
prefer lowercase start letter in property names in demos
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Apr 5, 2024
1 parent b88fc6c commit 7be74e6
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion demos/_unit-test/crud-nested.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
$entity = $model->load($id);

$innerCrud = Crud::addTo($v);
$innerCrud->setModel($entity->Products);
$innerCrud->setModel($entity->products);
});
2 changes: 1 addition & 1 deletion demos/collection/crud.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function addFormTo(View $view): Form

if (File::assertInstanceOf($this->action->getEntity())->is_folder) {
Grid::addTo($right, ['menu' => false, 'ipp' => 5])
->setModel(File::assertInstanceOf($this->getAction()->getModel())->SubFolder);
->setModel(File::assertInstanceOf($this->getAction()->getModel())->subFolder);
} else {
Message::addTo($right, ['Not a folder', 'type' => 'warning']);
}
Expand Down
2 changes: 1 addition & 1 deletion demos/collection/multitable.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ public function setModel(Model $model, array $route = []): void
->on('click', new JsModal('Now importing ... ', $vp));

$finderClass::addTo($app, ['bottom attached segment'])
->setModel($model->setLimit(10), [$model->fieldName()->SubFolder]);
->setModel($model->setLimit(10), [$model->fieldName()->subFolder]);
4 changes: 2 additions & 2 deletions demos/form-control/dropdown-plus.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
$form = Form::addTo($demo->right);

$form->addControl('category_id', [Form\Control\Dropdown::class, 'model' => new Category($app->db)]);
$form->addControl('sub_category_id', [Form\Control\DropdownCascade::class, 'cascadeFrom' => 'category_id', 'reference' => Category::hinting()->fieldName()->SubCategories]);
$form->addControl('product_id', [Form\Control\DropdownCascade::class, 'cascadeFrom' => 'sub_category_id', 'reference' => SubCategory::hinting()->fieldName()->Products]);
$form->addControl('sub_category_id', [Form\Control\DropdownCascade::class, 'cascadeFrom' => 'category_id', 'reference' => Category::hinting()->fieldName()->subCategories]);
$form->addControl('product_id', [Form\Control\DropdownCascade::class, 'cascadeFrom' => 'sub_category_id', 'reference' => SubCategory::hinting()->fieldName()->products]);

$form->onSubmit(static function (Form $form) use ($app) {
$message = $app->encodeJson($app->uiPersistence->typecastSaveRow($form->entity, $form->entity->get()));
Expand Down
18 changes: 9 additions & 9 deletions demos/init-db.php
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ class Percent extends Field
* @property string $name @Atk4\Field()
* @property string $type @Atk4\Field()
* @property bool $is_folder @Atk4\Field()
* @property File $SubFolder @Atk4\RefMany()
* @property File $subFolder @Atk4\RefMany()
* @property int $count @Atk4\Field()
* @property Folder $parent_folder_id @Atk4\RefOne()
*/
Expand All @@ -490,7 +490,7 @@ protected function init(): void
$this->addField($this->fieldName()->type, ['caption' => 'MIME Type']);
$this->addField($this->fieldName()->is_folder, ['type' => 'boolean']);

$this->hasMany($this->fieldName()->SubFolder, [
$this->hasMany($this->fieldName()->subFolder, [
'model' => [self::class],
'theirField' => self::hinting()->fieldName()->parent_folder_id,
])
Expand Down Expand Up @@ -538,7 +538,7 @@ public function importFromFilesystem(string $path, ?bool $isSub = null): void
]);

if ($fileinfo->isDir()) {
$entity->SubFolder->importFromFilesystem($fileinfo->getPath() . '/' . $fileinfo->getFilename(), true);
$entity->subFolder->importFromFilesystem($fileinfo->getPath() . '/' . $fileinfo->getFilename(), true);
}

// skip full/slow import for Behat CI testing
Expand All @@ -562,8 +562,8 @@ protected function init(): void

/**
* @property string $name @Atk4\Field()
* @property SubCategory $SubCategories @Atk4\RefMany()
* @property Product $Products @Atk4\RefMany()
* @property SubCategory $subCategories @Atk4\RefMany()
* @property Product $products @Atk4\RefMany()
*/
class Category extends ModelWithPrefixedFields
{
Expand All @@ -576,11 +576,11 @@ protected function init(): void

$this->addField($this->fieldName()->name);

$this->hasMany($this->fieldName()->SubCategories, [
$this->hasMany($this->fieldName()->subCategories, [
'model' => [SubCategory::class],
'theirField' => SubCategory::hinting()->fieldName()->product_category_id,
]);
$this->hasMany($this->fieldName()->Products, [
$this->hasMany($this->fieldName()->products, [
'model' => [Product::class],
'theirField' => Product::hinting()->fieldName()->product_category_id,
]);
Expand All @@ -590,7 +590,7 @@ protected function init(): void
/**
* @property string $name @Atk4\Field()
* @property Category $product_category_id @Atk4\RefOne()
* @property Product $Products @Atk4\RefMany()
* @property Product $products @Atk4\RefMany()
*/
class SubCategory extends ModelWithPrefixedFields
{
Expand All @@ -606,7 +606,7 @@ protected function init(): void
$this->hasOne($this->fieldName()->product_category_id, [
'model' => [Category::class],
]);
$this->hasMany($this->fieldName()->Products, [
$this->hasMany($this->fieldName()->products, [
'model' => [Product::class],
'theirField' => Product::hinting()->fieldName()->product_sub_category_id,
]);
Expand Down
4 changes: 2 additions & 2 deletions docs/form-control.md
Original file line number Diff line number Diff line change
Expand Up @@ -544,8 +544,8 @@ Assume that each data model are defined and model Category has many Sub-Category
```
$form = \Atk4\Ui\Form::addTo($app);
$form->addControl('category_id', [Dropdown::class, 'model' => new Category($db)]);
$form->addControl('sub_category_id', [DropdownCascade::class, 'cascadeFrom' => 'category_id', 'reference' => Category::hinting()->fieldName()->SubCategories]);
$form->addControl('product_id', [DropdownCascade::class, 'cascadeFrom' => 'sub_category_id', 'reference' => SubCategory::hinting()->fieldName()->Products]);
$form->addControl('sub_category_id', [DropdownCascade::class, 'cascadeFrom' => 'category_id', 'reference' => Category::hinting()->fieldName()->subCategories]);
$form->addControl('product_id', [DropdownCascade::class, 'cascadeFrom' => 'sub_category_id', 'reference' => SubCategory::hinting()->fieldName()->products]);
```

## Lookup
Expand Down

0 comments on commit 7be74e6

Please sign in to comment.