is this bundle ready for 2.2?
tworzenieweb opened this issue · 3 comments
I was trying to work with this bundle however when i am trying to save entity using custom DBAL type i get the following error:
Expected argument of type "integer", "string" given.
Stack Trace
in /home/tworzenieweb/www/fortrabbit/vendor/yethee/enum-bundle/Biplane/EnumBundle/Enumeration/FlaggedEnum.php at line 32
public static function isAcceptableValue($value)
{
if (!is_int($value)) {
throw new \InvalidArgumentException(sprintf(
'Expected argument of type "integer", "%s" given.',
is_object($value) ? get_class($value) : gettype($value)
));
at FlaggedEnum ::isAcceptableValue ('1')
in /home/tworzenieweb/www/fortrabbit/vendor/yethee/enum-bundle/Biplane/EnumBundle/Enumeration/Enum.php at line 37
at Enum ::create ('1')
in /home/tworzenieweb/www/fortrabbit/src/Tworzenieweb/Bundle/FortrabbitBundle/Doctrine/Type/PermissionType.php at line 29
at PermissionType ->convertToPHPValue ('1', object(MySqlPlatform))
in /home/tworzenieweb/www/fortrabbit/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php at line 121
at SimpleObjectHydrator ->hydrateRowData (array('name1' => 'fff', 'description2' => 'ddd', 'permission3' => '1', 'id4' => '3'), array('name1' => array('class' => object(ClassMetadata), 'name' => 'name', 'field' => true), 'description2' => array('class' => object(ClassMetadata), 'name' => 'description', 'field' => true), 'permission3' => array('class' => object(ClassMetadata), 'name' => 'permission', 'field' => true)), array())
in /home/tworzenieweb/www/fortrabbit/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php at line 50
at SimpleObjectHydrator ->hydrateAllData ()
in /home/tworzenieweb/www/fortrabbit/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php at line 111
at AbstractHydrator ->hydrateAll (object(PDOStatement), object(ResultSetMapping), array())
in /home/tworzenieweb/www/fortrabbit/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php at line 678
at BasicEntityPersister ->load (array('id' => '3'))
in /home/tworzenieweb/www/fortrabbit/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php at line 413
at EntityManager ->find ('Tworzenieweb\Bundle\FortrabbitBundle\Entity\Bookstore\Book', '3', '0', null)
in /home/tworzenieweb/www/fortrabbit/vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php at line 131
at EntityRepository ->find ('3')
in /home/tworzenieweb/www/fortrabbit/src/Tworzenieweb/Bundle/FortrabbitBundle/Controller/Bookstore/BookController.php at line 79
at BookController ->showAction ('3')
at call_user_func_array (array(object(BookController), 'showAction'), array('3'))
in kernel.root_dir/bootstrap.php.cache at line 1001
at HttpKernel ->handleRaw (object(Request), '1')
in kernel.root_dir/bootstrap.php.cache at line 975
at HttpKernel ->handle (object(Request), '1', true)
in kernel.root_dir/bootstrap.php.cache at line 1101
at ContainerAwareHttpKernel ->handle (object(Request), '1', true)
in kernel.root_dir/bootstrap.php.cache at line 411
at Kernel ->handle (object(Request))
in /home/tworzenieweb/www/fortrabbit/web/app_dev.php at line 26
You should cast a raw value to integer in your the custom type before call the factory method of enumeration.
Like this example:
public function convertToPHPValue($value, AbstractPlatform $platform)
{
return FooEnum::create((int)$value);
}
Ok thanks i suggest to update the doc to help other users start.
Done