Giter Club home page Giter Club logo

Comments (5)

rande avatar rande commented on July 17, 2024

Correct the sandbox is not yet completed, the path must be 'SonataPageBundle::layout.html.twig' and not NULL in your query

from sonatapagebundle.

zerkalica avatar zerkalica commented on July 17, 2024

I create some command for default template:

namespace Sonata\PageBundle\Command;

use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\Output;

use Application\Sonata\PageBundle\Entity\Template;

class CreateTemplatesCommand extends ContainerAwareCommand
{
    public function configure()
    {
        $this->setName('sonata:page:create-templates');
        $this->setDescription('Create a default templates');
    }

    public function execute(InputInterface $input, OutputInterface $output)
    {
        $em = $this->getContainer()->get('doctrine')->getEntityManager();

        $pageManager = $this->getContainer()->get('sonata.page.manager.page');

        $template = $pageManager->getDefaultTemplate();
        if (! $template) {
            $template = new Template();
            $template->setName('default');
            $template->setEnabled(true);
            $template->setPath('SonataPageBundle::layout.html.twig');
            $em->persist($template);
            $em->flush();
            $output->writeln(' Creating default template !');
        }

        $output->writeln(' OK !');
    }
}

from sonatapagebundle.

rande avatar rande commented on July 17, 2024

you should really learn how to create PR, github makes the workflow very easier, see http://help.github.com/send-pull-requests/

from sonatapagebundle.

rande avatar rande commented on July 17, 2024

btw I am removing the template table, as it's not a data that should be handled by the end user. so this logic is going to change to a configuration :

sonata_page:
    templates:
        - { default: true, path: 'SonataPageBundle::layout.html.twig', name: default }

from sonatapagebundle.

rande avatar rande commented on July 17, 2024

d146960

from sonatapagebundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.