-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added form for testing static analysis
- Loading branch information
matt
committed
Feb 25, 2024
1 parent
a0b4a21
commit dd4d4f7
Showing
3 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace KynxTest\Laminas\FormShape\StaticAnalysis; | ||
|
||
use Laminas\Form\Element\Hidden; | ||
use Laminas\Form\Element\Number; | ||
use Laminas\Form\Element\Select; | ||
use Laminas\Form\Element\Text; | ||
use Laminas\Form\Fieldset; | ||
|
||
final class Album extends Fieldset | ||
{ | ||
/** | ||
* @param int|null|string $name | ||
*/ | ||
public function __construct($name = null, array $options = []) | ||
{ | ||
parent::__construct($name, $options); | ||
|
||
$this->add(new Hidden('id')); | ||
$this->add(new Text('title')); | ||
$this->add(new Select('genre', ['value_options' => [1 => 'Punk', 2 => 'Shlock']])); | ||
$this->add(new Number('chart_position', ['min' => 1, 'max' => 100])); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace KynxTest\Laminas\FormShape\StaticAnalysis; | ||
|
||
use Laminas\Form\Element\Collection; | ||
use Laminas\Form\Element\Hidden; | ||
use Laminas\Form\Element\Text; | ||
use Laminas\Form\Form; | ||
|
||
final class Artist extends Form | ||
{ | ||
/** | ||
* @param int|null|string $name | ||
*/ | ||
public function __construct($name = null, array $options = []) | ||
{ | ||
parent::__construct($name, $options); | ||
|
||
$this->add(new Hidden('id')); | ||
$this->add(new Text('name')); | ||
$collection = new Collection('albums'); | ||
$collection->setTargetElement(new Album()); | ||
$this->add($collection); | ||
} | ||
} |