Skip to content

Instantly share code, notes, and snippets.

@clytemnestra
Last active June 3, 2016 08:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clytemnestra/450181f5b01bb55594747c9847a7c748 to your computer and use it in GitHub Desktop.
Save clytemnestra/450181f5b01bb55594747c9847a7c748 to your computer and use it in GitHub Desktop.
ctrl+12 file structure
ctrl+f11 si ctrl+1,2,3.. un fel de bookmark in file, in loc de //ojojojojo
If PhpStorm doesn't recognize the class of a variable, you can manually set it with comments.
/** @var $variableName Some_Class_Here */
SONATAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
/*
protected function configureRoutes(RouteCollection $collection)
{
// to remove a single route
$collection->remove('delete');
// OR remove all route except named ones
$collection->clearExcept(array('list', 'show'));
}*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('date','sonata_type_datetime_picker',array('dp_side_by_side'=> true))
;
}
public function getVoteCount()
{
return count($this->getVotes());
}
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->add('locked', null, array('editable' => true))
->add('profilepic', null, array(
'template' => 'MedAppBundle:AdminSonata/CRUD:picture.html.twig'
}
protected function configureListFields(ListMapper $listMapper)
{
unset($this->listModes['mosaic']);
$listMapper
->add('vote_count')
;
}
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('lastLogin', 'doctrine_orm_datetime_range', array('field_type' => 'sonata_type_datetime_range_picker'))
//->add('lastLogin', 'doctrine_orm_datetime', array('field_type'=>'sonata_type_datetime_picker'))
}
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
/* ->tab('General')
->with('Addresses', array(
'class' => 'col-md-8',
'box_class' => 'box box-solid box-danger',
'description' => 'Lorem ipsum',
))*/
->add('profilepic', 'sonata_media_type', array(
'provider' => 'sonata.media.provider.image',
'context' => 'profile_pics'
));
/* ->end()
->end();*/
;
}
if ($this->getRoot()->getClass() == 'AppBundle\Entity\Foo') {
// only field for FooAdmin
}
// Create the form using $this->createForm() ...
$myView = $myform->createView();
//Set the form theme
$this->get('twig')->getExtension('form')->renderer->setTheme($myView, 'XBundle:path/to/theme/myTheme.html.twig');
$content = $this->renderView('XBundle:path/to/template/myTemplate.html.twig', array('templateParam1' => $myView, 'templateParam2' => $param2));
return new Response($content);
php app/console sonata:easy-extends:generate --dest=src SonataMediaBundle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment