background preloader

Symfony2 cheat sheet

Symfony2 cheat sheet

Twig : Les filtres disponibles - Alexandre Clain Autant vous le dire tout de suite, je suis tombé littéralement amoureux de Symfony 2. Pratiquant incontesté du MVC et des bonnes pratiques de programmation, je prends particulièrement soin d’utiliser la puissance d’un moteur de template pour bien séparer le code HTML du PHP. Voici un aide mémoire sur la liste de tous les filtres qui sont disponible sous Twig, en espérant que cet anti-séche vous servira autant qu’à moi. Retourner une valeur absolue : abs() Permet de s’assurer d’avoir l’affichage d’une valeur positive sur sa vue. Formater une chaîne pour mettre le premier caractère en capitale : capitalize() Ce filtre peut être utile quand vous voulez absolument que la chaîne de caractère commence par une lettre en capitale. Modifier l’encodage par un un autre : convert_encoding() Si vous récupérer une chaîne de caractère avec le mauvais encodage vous pourrez directement modifier cela dans la vue. Formater l’affichage d’une date : date() Modifier la valeur d’une date : date_modify()

DDD with Symfony2: Folder Structure And Code First | William DURAND 2013-08-11 - Move JMSSerializerBundle configuration files into the ApiBundle bundle. Domain Driven Design also known as DDD is an approach to develop software for complex needs by connecting the implementation to an evolving model. It is a way of thinking and a set of priorities, aimed at accelerating software projects that have to deal with complicated domains. It is possible to use this approach in a Symfony2 project, and that is what I am going to introduce in a series of blog posts. Bootstrap¶ Start by creating a fresh project using the symfony-standard edition: composer create-project symfony/framework-standard-edition path/to/install I use to remove unecessary files such as src/*, as well as useless bundles. Don't forget to update the AppKernel class accordingly. Folder Structure¶ As Mathias Verraes stated in his blog post about Code Folder Structures, most of the usual Symfony2 project folder structures are not efficient. In your case, the domain expert said users are centrepieces. <?

Twig for Developers - Documentation - Twig - The flexible, fast, and secure PHP template engine This chapter describes the API to Twig and not the template language. It will be most useful as reference to those implementing the template interface to the application and not those who are creating Twig templates. Basics Twig uses a central object called the environment (of class Twig_Environment). Instances of this class are used to store the configuration and extensions, and are used to load templates from the file system or other locations. Most applications will create one Twig_Environment object on application initialization and use that to load templates. The simplest way to configure Twig to load templates for your application looks roughly like this: This will create a template environment with the default settings and a loader that looks up the templates in the /path/to/templates/ folder. Note Notice that the second argument of the environment is an array of options. To render the template with some variables, call the render() method: Environment Options Loaders Compilation Cache

symfony API » sfValidatorBase Class (sfValidatorBase) addMessage ($name, $value) Browse code Adds a new error code with a default error message. returns The current validator instance (sfValidatorBase) addOption ($name, $value) Browse code Adds a new option value with a default value. returns The current validator instance (sfValidatorBase) addRequiredOption ($name) Browse code Adds a required option. returns The current validator instance (string) asString ($indent) Browse code Returns a string representation of this validator. returns The string representation of the validator (mixed) clean ($value) Browse code Cleans the input value. This method is also responsible for trimming the input value and checking the required option. returns The cleaned value throws sfValidatorError configure ($options, $messages) Browse code Configures the current validator. This method allows each validator to add options and error messages during validator creation.

NDP Software :: Git Cheatsheet stash workspace index local repository upstream repository status Displays: <br>• paths that have differences between the index file and the current <code>HEAD</code> commit, <br>• paths that have differences between the workspace and the index file, and <br>• paths in the workspace that are not tracked by git. diff Displays the differences not added to the index. diff commit or branch View the changes you have in your workspace relative to the named <em>commit</em>. add file... or dir... Adds the current content of new or modified files to the index, thus staging that content for inclusion in the next commit. add -u Adds the current content of modified (NOT NEW) files to the index. rm file(s)... Remove a file from the workspace and the index. mv file(s)... Move file in the workspace and the index. commit -a -m 'msg' Commit all files changed since your last commit, except untracked files (ie. all files that are already listed in the index). checkout files(s)... or dir reset HEAD file(s)... reset --hard

EmanueleMinotto/awesome-symfony2 · GitHub Dublin Tech: JavaScript language a- z cheat sheet Here is an A - Z list of some Javascript idioms and patterns. The idea is to convey in simple terms some features of the actual Javascript language (rather than how it can interact with DOM). Enjoy... Array Literals An array literal can be defined using a comma separated list in square brackets. Arrays in javascript have a wide selection methods including push() and pop(). In the example above, the chanceCivilisationCallback callback function is invoked by peakOil. Configuration Object Instead of passing around a bunch of related properties... Use a configuration object The use of a configuration object makes it makes it easier to write clean APIs that don't need to take a huge long list of parameters. Note: The closure is the object literal returned from annoymous function. Constructor Functions (Built in) There are no classes in Javascript but there are construtor functions which use the new keyword syntax similar to the class based object creation in Java or other languages. Then...

Collecting all the cheat sheets Ressources en ligne pour les Web Designers Cheat Sheet by Weizu - Download free from Cheatography - Cheatography.com: Cheat Sheets For Every Occasion Show Menu Log out Cheat Sheet Lists Login or Register Download This Cheat Sheet (PDF) Ressources en ligne pour les Web Designers Cheat Sheet by Weizu php css webdesign html cms web js Download the Ressources en ligne pour les Web Designers Cheat Sheet 4 Pages PDF (recommended) PDF (4 pages) Alternative Downloads Share This Cheat Sheet! Like this cheat sheet? Readable.io is a collection of tools to make your writing better. Click Here To Get Started! Cheatographer Weizualexandre.achain.chez.com Metadata Favourited By Comments No comments yet. Add a Comment Related Cheat Sheets CSS2 Cheat Sheet Bootstrap Cheat Sheet Bootstrap Glyphicons Cheat Sheet by James Croft More Cheat Sheets by Weizu Ressources pour Bootstrap Cheat Sheet Les Top 10 des plateformes de MOOCs Cheat Sheet HTML5 Boilerplate Cheat Sheet What could you use a cheat sheet for? Latest Cheat Sheet 8F Statistics Test Cheat Sheet Most Popular Cheat Sheet Regular Expressions Cheat Sheet Random Cheat Sheet Cracker Barrel Food Alergens Cheat Sheet DaveChild

Panic Over! PHP, CSS & HTML Help Sheets - GoSquared Blog Today, we’re introducing our all new Help Sheets. You loved our original CSS and HTML Help Sheets, so we went back to the originals, tidied them up, and gave them a sprinkling of coolness. We’re also pleased to bring you an entirely new Help Sheet – the PHP Help Sheet. This should be a saviour for you hardcore coders when you forget the odd array function or two. New to GoSquared? For those of you new to GoSquared – we help people improve their websites. You can download the full set as a ZIP (5.4MB) right here: The all new PHP Help Sheet. Get the PDF (1.9MB) The HTML Help Sheet has been updated and tidied up, so now you have no excuses for not decorating your office notice board with snippets of usefulness. The CSS Help Sheet – our first ever, but updated to match the set. Update: We’ve redesigned the CSS Help Sheet. We hope you like the new Help Sheets, and would love to know what you want us to Help Sheet-ise next: JavaScript? Enjoy!

Related: