for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace DoS\ResourceBundle\Form\Type;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Common\Persistence\ObjectRepository;
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType as BaseAbstractResourceType;
abstract class AbstractResourceType extends BaseAbstractResourceType
{
/**
* @var string
*/
protected $name;
* @var ObjectManager
protected $manager;
* @var ObjectRepository
protected $repository;
* @param ObjectManager|null $manager
public function setObjectManager(ObjectManager $manager = null)
$this->manager = $manager;
$this->repository = $manager->getRepository($this->dataClass);
$manager
null
If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe:
function someFunction(A $objectMaybe = null) { if ($objectMaybe instanceof A) { $objectMaybe->doSomething(); } }
}
* {@inheritdoc}
public function __construct($dataClass, array $validationGroups = array(), $name = null)
parent::__construct($dataClass, $validationGroups);
$this->name = $name;
public function getName()
return $this->name;
If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe: