-
-
Save anonymous/08bf222baa5c250b4614 to your computer and use it in GitHub Desktop.
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
<?php | |
namespace UsaRugbyStats\Competition\Form\Fieldset\Union; | |
use Doctrine\Common\Persistence\ObjectManager; | |
use DoctrineModule\Form\Element\ObjectSelect; | |
use Zend\Form\Fieldset; | |
use Doctrine\Common\Persistence\ObjectRepository; | |
use Zend\InputFilter\InputFilterProviderInterface; | |
class TeamFieldset extends Fieldset implements InputFilterProviderInterface | |
{ | |
protected $teamRepo; | |
public function __construct(ObjectManager $om, ObjectRepository $mapper) | |
{ | |
parent::__construct('team'); | |
$this->teamRepo = $mapper; | |
$team = new ObjectSelect(); | |
$team->setName('id'); | |
$team->setOptions(array( | |
'label' => 'Team', | |
'object_manager' => $om, | |
'target_class' => 'UsaRugbyStats\Competition\Entity\Team', | |
)); | |
$this->add($team); | |
} | |
public function getTeam($teamid = NULL) | |
{ | |
if (empty($teamid)) { | |
$teamid = $this->get('id')->getValue(); | |
} | |
if (empty($teamid)) { | |
return null; | |
} | |
return $this->teamRepo->find($teamid); | |
} | |
public function getInputFilterSpecification() | |
{ | |
return array( | |
'id' => array( | |
'required' => false, | |
) | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment