Awesome set of videos, but at the end you say that you can press command a to select all and then reformat everything... with nothing selected, reformat will do the entire document. Simples. One less step 😁
I get this errors :( [1] Symfony\Component\Debug\Exception\ContextErrorException: Warning: count(): Parameter must be an array or an object that implements Countable at n/a in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\Validator\Validator\RecursiveContextualValidator.php line 749
at Symfony\Component\Debug\ErrorHandler->handleError('2', 'count(): Parameter must be an array or an object that implements Countable', 'E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\Validator\Validator\RecursiveContextualValidator.php', '749', array('value' => object(OrderedHashMap), 'object' => object(Form), 'cacheKey' => '00000000026da31d000000000e4f5a66:children', 'metadata' => object(PropertyMetadata), 'propertyPath' => 'children', 'groups' => array('Default'), 'cascadedGroups' => null, 'traversalStrategy' => '1', 'context' => object(ExecutionContext), 'group' => 'Default', 'key' => '0', 'cascadingStrategy' => '2')) in line
at count(null) in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\Validator\Validator\RecursiveContextualValidator.php line 749
at Symfony\Component\Validator\Validator\RecursiveContextualValidator->validateGenericNode(object(OrderedHashMap), object(Form), '00000000026da31d000000000e4f5a66:children', object(PropertyMetadata), 'children', array('Default'), null, '1', object(ExecutionContext)) in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\Validator\Validator\RecursiveContextualValidator.php line 617
at Symfony\Component\Validator\Validator\RecursiveContextualValidator->validateClassNode(object(Form), '00000000026da31d000000000e4f5a66', object(ClassMetadata), '', array('Default'), null, '1', object(ExecutionContext)) in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\Validator\Validator\RecursiveContextualValidator.php line 373
at Symfony\Component\Validator\Validator\RecursiveContextualValidator->validateObject(object(Form), '', array('Default'), '1', object(ExecutionContext)) in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\Validator\Validator\RecursiveContextualValidator.php line 162
at Symfony\Component\Validator\Validator\RecursiveContextualValidator->validate(object(Form), null, array('Default')) in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\Validator\Validator\RecursiveValidator.php line 132
at Symfony\Component\Validator\Validator\RecursiveValidator->validate(object(Form)) in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\Form\Extension\Validator\EventListener\ValidationListener.php line 68
at Symfony\Component\Form\Extension\Validator\EventListener\ValidationListener->validateForm(object(FormEvent), 'form.post_bind', object(EventDispatcher)) in line
at call_user_func(array(object(ValidationListener), 'validateForm'), object(FormEvent), 'form.post_bind', object(EventDispatcher)) in E:\code\symfony\phpstorm\app\cache\dev\classes.php line 1858
at Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(array(array(object(ValidationListener), 'validateForm'), array(object(DataCollectorListener), 'postSubmit')), 'form.post_bind', object(FormEvent)) in E:\code\symfony\phpstorm\app\cache\dev\classes.php line 1773
at Symfony\Component\EventDispatcher\EventDispatcher->dispatch('form.post_bind', object(FormEvent)) in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\EventDispatcher\ImmutableEventDispatcher.php line 43
at Symfony\Component\EventDispatcher\ImmutableEventDispatcher->dispatch('form.post_bind', object(FormEvent)) in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\Form\Form.php line 660
at Symfony\Component\Form\Form->submit(array(), true) in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationRequestHandler.php line 113
at Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationRequestHandler->handleRequest(object(Form), object(Request)) in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\Form\Form.php line 489
at Symfony\Component\Form\Form->handleRequest(object(Request)) in E:\code\symfony\phpstorm\src\AppBundle\Controller\MovieController.php line 21
at AppBundle\Controller\MovieController->newAction(object(Request)) in line
at call_user_func_array(array(object(MovieController), 'newAction'), array(object(Request))) in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\HttpKernel.php line 144
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), '1') in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\HttpKernel.php line 64
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), '1', true) in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel.php line 69
at Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(object(Request), '1', true) in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php line 185
at Symfony\Component\HttpKernel\Kernel->handle(object(Request)) in E:\code\symfony\phpstorm\web\app_dev.php line 28
at require('E:\code\symfony\phpstorm\web\app_dev.php') in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Resources\config\router_dev.php line 40
if i submit form this error message show up "Warning: count(): Parameter must be an array or an object that implements Countable". How to make sure that form sending data?. I am using symfony 2.8
Hmm, I believe that error comes from an incompatible library with your current PHP version. Did you download the course code from this page? Try updating the validator component composer up symfony/validator
Nice tip, thank you! ;) Yeah, you can use "Code" -> "Optimize Imports" (or Control + Alt + O on a Mac) to remove unused namespaces and reorder them alphabetically.
Yep, I know that error :). It means that there's a syntax error in the annotations above the samsCharacterName in your Movie entity - you might be missing a comma between your properties (e.g. @ORM\Column(name="sams_character_name", length=255).
I've been doing some refactoring (of course, using phpstorm), and I found a problem that I just can't solve. When I refactor a field name from a class, lets say "type" to "format", the getter and setter method get's refactored automatically, but my problem relys on my twig templates that make use of those methods, they don't get refactored, so I have to make those changes manually. This is killing me D:
As for me, in this case I do "Replace in Path" (shift+command+R on any folder in project) for property name including dot in the beginning of it, i.e. .type => .format. For unique properties it helps a lot! But if property not unique, you could skip it during refactoring.
Yep, I do something similar - I use Refactor in PhpStorm... but I know it's not perfect (it never could be - there are some things that are just too dynamic for phpstorm to realize). I grep my code-base a lot to be completely sure when I make these changes. In this case, I would search for Twig instances by using:
git grep '\.type'
I wasn't familiar with the "Replace in Path" - that sounds very cool!
14 Comments
Awesome set of videos, but at the end you say that you can press command a to select all and then reformat everything... with nothing selected, reformat will do the entire document. Simples. One less step 😁
Awesome!
I get this errors :(
[1] Symfony\Component\Debug\Exception\ContextErrorException: Warning: count(): Parameter must be an array or an object that implements Countable
at n/a
in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\Validator\Validator\RecursiveContextualValidator.php line 749
at Symfony\Component\Debug\ErrorHandler->handleError('2', 'count(): Parameter must be an array or an object that implements Countable', 'E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\Validator\Validator\RecursiveContextualValidator.php', '749', array('value' => object(OrderedHashMap), 'object' => object(Form), 'cacheKey' => '00000000026da31d000000000e4f5a66:children', 'metadata' => object(PropertyMetadata), 'propertyPath' => 'children', 'groups' => array('Default'), 'cascadedGroups' => null, 'traversalStrategy' => '1', 'context' => object(ExecutionContext), 'group' => 'Default', 'key' => '0', 'cascadingStrategy' => '2'))
in line
at count(null)
in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\Validator\Validator\RecursiveContextualValidator.php line 749
at Symfony\Component\Validator\Validator\RecursiveContextualValidator->validateGenericNode(object(OrderedHashMap), object(Form), '00000000026da31d000000000e4f5a66:children', object(PropertyMetadata), 'children', array('Default'), null, '1', object(ExecutionContext))
in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\Validator\Validator\RecursiveContextualValidator.php line 617
at Symfony\Component\Validator\Validator\RecursiveContextualValidator->validateClassNode(object(Form), '00000000026da31d000000000e4f5a66', object(ClassMetadata), '', array('Default'), null, '1', object(ExecutionContext))
in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\Validator\Validator\RecursiveContextualValidator.php line 373
at Symfony\Component\Validator\Validator\RecursiveContextualValidator->validateObject(object(Form), '', array('Default'), '1', object(ExecutionContext))
in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\Validator\Validator\RecursiveContextualValidator.php line 162
at Symfony\Component\Validator\Validator\RecursiveContextualValidator->validate(object(Form), null, array('Default'))
in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\Validator\Validator\RecursiveValidator.php line 132
at Symfony\Component\Validator\Validator\RecursiveValidator->validate(object(Form))
in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\Form\Extension\Validator\EventListener\ValidationListener.php line 68
at Symfony\Component\Form\Extension\Validator\EventListener\ValidationListener->validateForm(object(FormEvent), 'form.post_bind', object(EventDispatcher))
in line
at call_user_func(array(object(ValidationListener), 'validateForm'), object(FormEvent), 'form.post_bind', object(EventDispatcher))
in E:\code\symfony\phpstorm\app\cache\dev\classes.php line 1858
at Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(array(array(object(ValidationListener), 'validateForm'), array(object(DataCollectorListener), 'postSubmit')), 'form.post_bind', object(FormEvent))
in E:\code\symfony\phpstorm\app\cache\dev\classes.php line 1773
at Symfony\Component\EventDispatcher\EventDispatcher->dispatch('form.post_bind', object(FormEvent))
in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\EventDispatcher\ImmutableEventDispatcher.php line 43
at Symfony\Component\EventDispatcher\ImmutableEventDispatcher->dispatch('form.post_bind', object(FormEvent))
in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\Form\Form.php line 660
at Symfony\Component\Form\Form->submit(array(), true)
in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationRequestHandler.php line 113
at Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationRequestHandler->handleRequest(object(Form), object(Request))
in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\Form\Form.php line 489
at Symfony\Component\Form\Form->handleRequest(object(Request))
in E:\code\symfony\phpstorm\src\AppBundle\Controller\MovieController.php line 21
at AppBundle\Controller\MovieController->newAction(object(Request))
in line
at call_user_func_array(array(object(MovieController), 'newAction'), array(object(Request)))
in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\HttpKernel.php line 144
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), '1')
in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\HttpKernel.php line 64
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), '1', true)
in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel.php line 69
at Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(object(Request), '1', true)
in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php line 185
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
in E:\code\symfony\phpstorm\web\app_dev.php line 28
at require('E:\code\symfony\phpstorm\web\app_dev.php')
in E:\code\symfony\phpstorm\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Resources\config\router_dev.php line 40
Hey Rizky A.
Could you give more context please. What caused that error? What Symfony and PHP version are you using?
Cheers!
if i submit form this error message show up "Warning: count(): Parameter must be an array or an object that implements Countable". How to make sure that form sending data?. I am using symfony 2.8
Hmm, I believe that error comes from an incompatible library with your current PHP version. Did you download the course code from this page?
Try updating the validator component
composer up symfony/validatorYou missed the "Optimize imports" feature at 4:54 ;)
Hey Jacek,
Nice tip, thank you! ;) Yeah, you can use "Code" -> "Optimize Imports" (or Control + Alt + O on a Mac) to remove unused namespaces and reorder them alphabetically.
P.S. I added a note about it here: https://github.com/knpunive...
Cheers!
Hi,
When i attempt ./app/console doctrine:schema:create I receive this error [Doctrine\Common\Annotations\AnnotationException]
[Syntax Error] Expected Doctrine\Common\Annotations\DocLexer::T_CLOSE_PARENTHESIS, got
'length' at position 26 in property AppBundle\Entity\Movie::$samsCharacterName.
doctrine:schema:create [--dump-sql] [--em [EM]]
Probably something simple but I can't seem to work it out
Hey Matt!
Yep, I know that error :). It means that there's a syntax error in the annotations above the samsCharacterName in your Movie entity - you might be missing a comma between your properties (e.g. @ORM\Column(name="sams_character_name", length=255).
Btw, I like your entity+property name :)
Cheers!
Hey Ryan! how's going ?
I've been doing some refactoring (of course, using phpstorm), and I found a problem that I just can't solve.
When I refactor a field name from a class, lets say "type" to "format", the getter and setter method get's refactored automatically, but my problem relys on my twig templates that make use of those methods, they don't get refactored, so I have to make those changes manually.
This is killing me D:
Any help is very appreciated.
Hey, Diego!
As for me, in this case I do "Replace in Path" (
shift+command+Ron any folder in project) for property name including dot in the beginning of it, i.e..type=>.format. For unique properties it helps a lot! But if property not unique, you could skip it during refactoring.Cheers!
Yep, I do something similar - I use Refactor in PhpStorm... but I know it's not perfect (it never could be - there are some things that are just too dynamic for phpstorm to realize). I grep my code-base a lot to be completely sure when I make these changes. In this case, I would search for Twig instances by using:
I wasn't familiar with the "Replace in Path" - that sounds very cool!
Cheers!
That's cool!
thank you both for your time :D
"Houston: no signs of life"
Start the conversation!