This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Symfony2 project with frontend+backend | |
Architecture example | |
- Only one kernel. | |
- Bundles can have different routing files, controllers and views for frontend and backend | |
- bundle different routing files are imported from app/config/routing.yml using prefixes | |
app/ | |
AppKernel | |
config/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<select id="article_publishedAt_month" name="article[publishedAt][month]"> | |
<option value="1">Jan</option> | |
<option value="2">Feb</option> | |
<option value="3">Mar</option> | |
<option value="4">Apr</option> | |
<option value="5">May</option> | |
<option value="6">Jun</option> | |
<option value="7">Jul</option> | |
<option value="8">Aug</option> | |
<option value="9" selected="selected">Sep</option> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Mapping | |
unmap ? | |
map ? enterFindMode | |
map = showHelp | |
unmap gf | |
# Hints | |
qsdfghjklm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias ll='ls -l' | |
alias la='ls -A' | |
alias l='ls -CF' | |
alias sf='php symfony' | |
alias git-archive='git archive' | |
alias swap='sudo swapoff -a && sudo swapon -a' | |
alias apt-hop='sudo apt-get update && sudo apt-get upgrade' | |
alias s='git status' | |
alias d='git diff' | |
alias subupdate='git submodule sync && git submodule update --init --recursive' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Application\ExerciseBundle\Twig\Extension; | |
class ExerciseTwigExtension extends \Twig_Extension | |
{ | |
public function getFilters() | |
{ | |
return array( | |
'numberFormat' => new \Twig_Filter_Method($this, 'numberFormatFilter'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TagCollection implements Collection | |
{ | |
/** | |
* Magic PHP method that intercepts method calls and redirects them to the internal collection object | |
* | |
* @param string $method The method on the object to be called | |
* @param array $args An array of arguments to be passed to the method | |
* | |
* @return mixed The result of the method | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function preUpdate(PreUpdateEventArgs $eventArgs) | |
{ | |
$document = $eventArgs->getDocument(); | |
$isTagsChanged = $eventArgs->hasChangedField('tags') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Article extends Content | |
{ | |
protected $comments; // a Collection implementation, ArrayCollection or PersistentCollection | |
// get the ArrayCollection or PersistentCollection | |
public function getComments() | |
{ | |
return $this->comments; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" disable arrow keys | |
map <up> <nop> | |
map <down> <nop> | |
map <left> <nop> | |
map <right> <nop> | |
imap <up> <nop> | |
imap <down> <nop> | |
imap <left> <nop> | |
imap <right> <nop> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://github.com/fabpot/symfony/commit/8fbf19694f253e8bacdd677362ee58967506bbb3 | |
Here is a vim command to update mongodb document mapping annotation (requires the DirDo plugin http://www.vim.org/scripts/script.php?script_id=367) | |
:DDF src/Bundle,src/Application *.php %s/\v\\*(\\s+)\@(Document|Id|Field|String|Int|Float|Bool|Date|Distance|Reference|Embed|Mapped|HasLife|Index|UniqueIndex|Hash)/*\\1@mongodb:\\2/gIce\ |\ update |