symfony-2.6

phpunit in symfony2 - No tests executed

孤者浪人 提交于 2019-12-12 15:13:14
问题 Solved - see answer below I have a problem. I'm trying to test some functional tests with phpunit. The problem is that when i use phpunit -c app in command prompt I get No tests executed! . It seems that the path to my application is not right. I tried to change the path in my phpunit.xml.dist . I changed it many times, but the "guess" standard code seems to be the best, <directory>../src/*/*Bundle/Tests</directory> <directory>../src/*/Bundle/*Bundle/Tests</directory> Those links doesn't seem

FOSUserBundle + HWIOAuth security configuration failed

孤街醉人 提交于 2019-12-12 05:38:54
问题 I'm trying to get FOSUserBundle and HWIOAuth working together for handle the authentication of two types of users: representatives and interns. The representatives ones would begin using HWIOAuth and would use Salesforce and internal FOSUserBundle. I'm trying to set everything but I have problems because Symfony throws this error when I try to access the /login-salesforce or /admin routes. InvalidConfigurationException in BaseNode.php line 313: Invalid configuration for path "security

Twig dump isn't printing anything

泄露秘密 提交于 2019-12-10 20:51:23
问题 I am a little bit confused right now. I always used the twig dump function like any other twig function but now it has absolutely no output. No errors/exceptions, just nothing. Everything else is working fine, like the trans filter. {{ dump('test') }} # prints nothing {{ 'layout.booking.chooseArea'|trans }} # prints the translated message Right now this template doesn't contain anything more than that. The dump also doesn't work in the parent template or in base.html.twig. Again, the dump

How do I check if object was found in a Doctrine2 repository?

人走茶凉 提交于 2019-12-10 13:00:03
问题 I am finding a entity by its PK as follow: $ent = $em->getRepository('AppBundle:Representative')->find($id) What is the right way to check whether $ent is a real Representative object or not? What I mean with real is that $ent currently exists on DB and was returned since I am planning to use the same results for INSERT and UPDATE . In pseudo-code what is on my head is: if (ent is Representative) { // Update its values } else { // Create a new Representative } I was thinking in use is_object(

Symfony: LoggingTranslator vs Translator

那年仲夏 提交于 2019-12-10 03:09:23
问题 I want to inject my translations string into a service, so I used this in the service definition: arguments: [@doctrine.orm.entity_manager, @translator] I used this in the constructor: public function __construct(\Doctrine\ORM\EntityManager $entityManager, \Symfony\Component\Translation\Translator $translator) But I get this error: .... __construct() must be an instance of Symfony\Component\Translation\Translator, instance of Symfony\Component\Translation\LoggingTranslator given... What is

Default Options for symfony 2 forms are being overridden not merged

别说谁变了你拦得住时间么 提交于 2019-12-08 04:55:03
问题 I have a custom form type that defines some default attr options: public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( 'invalid_message' => 'The selected image does not exist', 'attr'=>array( 'data-image-picker'=>'true', 'data-label'=>'Pick Image' ), )); } However when i use this custom form type the entire attr array is replaced with what is defined. $builder->add('logo','image_picker',array( 'attr'=>array( 'data-label'=>'Logo' ), )); When the

How to get Container object from LifecycleEventArgs of postLoad in Entity?

北战南征 提交于 2019-12-04 15:11:21
I'm trying to inject the Container object (which is available in controllers) into an Entity using postLoad lifecycleCallbacks . The argument to the postLoad method is LifecycleEventArgs . I could see the container property (which I want to retrieve) in EventManager of LifecycleEventArgs according to the dump output, but it seems to be a private property and there is no getContainer() method in EventManager . The below is my code. service.yml services: ibw.jobeet.entity.job.container_aware: class: Ibw\JobeetBundle\Entity\Job tags: - { name: doctrine.event_listener, event: postLoad } Ibw

How to remove fields from the admin user create page of Sonata User Bundle?

天大地大妈咪最大 提交于 2019-11-29 17:23:20
I have installed Sonata Admin Bundle and User Bundle in my Symfony 2.6 application. I found that the User bundle creates a bundle at src/Application/Sonata/UserBundle . When I go to the admin user creation page ( admin/sonata/user/user/create ), I found a lot of fields there: General Username E-Mail-Address Plain password Groups Profile Date of birth Firstname Lastname Website Biography Gender Locale Timezone Phone Social Facebook Uid Facebook Name Twitter Uid Twitter Name Google+ Uid Google+ Name Management Roles Locked Expired Enabled Credentails expired Security Token Two Step Verification