Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempted to call method "ifTrue" on class "Sonata\AdminBundle\Form\FormMapper". #88

Closed
btribouillet opened this issue Jan 30, 2015 · 2 comments

Comments

@btribouillet
Copy link

I'm facing that issue when i'm trying to access the route "/admin/sonata/classification/context/create". I have no ideas where it could come from. I've been following the Documentation step by step.

Attempted to call method "ifTrue" on class "Sonata\AdminBundle\Form\FormMapper".
in vendor/sonata-project/classification-bundle/Admin/ContextAdmin.php at line 27 :

protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->ifTrue($this->getSubject()->getId() === null)
->add('id')
->ifEnd()
->add('name')

Here my composer.json :

"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.6.",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "~1.2",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~3.0.12",
"sensio/framework-extra-bundle": "~3.0",
"incenteev/composer-parameter-handler": "~2.0",
"sonata-project/core-bundle": "~2.2@dev",
"sonata-project/notification-bundle": "~2.3",
"knplabs/knp-markdown-bundle": "~1.2",
"videlalvaro/php-amqplib": "~2.4",
"liip/monitor-bundle": "~2.0",
"symfony-cmf/routing-bundle": "1.4.
@dev",
"jms/serializer-bundle": "0.13.*@dev",
"sonata-project/formatter-bundle": "~2.3",
"sonata-project/markitup-bundle": "~2.1",
"sonata-project/intl-bundle": "~2.2",
"sonata-project/cache-bundle": "~2.2",
"sonata-project/seo-bundle": "~1.1",
"sonata-project/easy-extends-bundle": "~2.1",
"sonata-project/admin-bundle": "~2.3",
"sonata-project/doctrine-orm-admin-bundle": "~2.3",
"sonata-project/user-bundle": "~2.2",
"sonata-project/classification-bundle": "dev-master",
"sonata-project/news-bundle": "dev-master",
"sonata-project/timeline-bundle": "~2.2@dev",
"sonata-project/media-bundle": "~2.4@dev",
"sonata-project/page-bundle": "~2.3@dev"
},

And my AppKernel.php :

$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new JMS\SerializerBundle\JMSSerializerBundle(),
new Knp\Bundle\MarkdownBundle\KnpMarkdownBundle(),
new Knp\Bundle\MenuBundle\KnpMenuBundle(),
new Ivory\CKEditorBundle\IvoryCKEditorBundle(),
new FOS\UserBundle\FOSUserBundle(),
new Spy\TimelineBundle\SpyTimelineBundle(),
new Symfony\Cmf\Bundle\RoutingBundle\CmfRoutingBundle(),
new Sonata\CoreBundle\SonataCoreBundle(),
new Sonata\NotificationBundle\SonataNotificationBundle(),
new Sonata\MarkItUpBundle\SonataMarkItUpBundle(),
new Sonata\FormatterBundle\SonataFormatterBundle(),
new Sonata\IntlBundle\SonataIntlBundle(),
new Sonata\CacheBundle\SonataCacheBundle(),
new Sonata\SeoBundle\SonataSeoBundle(),
new Sonata\BlockBundle\SonataBlockBundle(),
new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
new Sonata\AdminBundle\SonataAdminBundle(),
new Sonata\UserBundle\SonataUserBundle('FOSUserBundle'),
new Sonata\ClassificationBundle\SonataClassificationBundle(),
new Sonata\MediaBundle\SonataMediaBundle(),
new Sonata\NewsBundle\SonataNewsBundle(),
new Sonata\EasyExtendsBundle\SonataEasyExtendsBundle(),
new Sonata\TimelineBundle\SonataTimelineBundle(),
new Sonata\PageBundle\SonataPageBundle(),
new Application\Sonata\UserBundle\ApplicationSonataUserBundle(),
new Application\Sonata\ClassificationBundle\ApplicationSonataClassificationBundle(),
new Application\Sonata\MediaBundle\ApplicationSonataMediaBundle(),
new Application\Sonata\NewsBundle\ApplicationSonataNewsBundle(),
new Application\Sonata\TimelineBundle\ApplicationSonataTimelineBundle(),
new Application\Sonata\PageBundle\ApplicationSonataPageBundle(),
new Application\Sonata\NotificationBundle\ApplicationSonataNotificationBundle(),
new AppBundle\AppBundle(),
);

I wonder is this would help :

1 - DEBUG - Router Sonata\PageBundle\Route\CmsPageRouter was not able to match, message "No site defined"

@antoinemineau
Copy link

@btribouillet
Copy link
Author

Okay it is solved. I was using dev versions ... This is why IfTrue didn't exist. I changed my bundles to the stable version and it did solve all the problems. Thank you for the help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants