Skip to content

Instantly share code, notes, and snippets.

class User extends Doctrine_Record
{
protected $username;
public function setName($name)
{
$this->username = $name;
}
}
# models.py
class Item(models.Model):
name = models.CharField(max_length=60)
created = models.DateTimeField(auto_now_add=True)
priority = models.IntegerField(default=0)
difficulty = models.IntegerField(default=0)
done = models.BooleanField(default=False)
class ItemAdmin(admin.ModelAdmin):
list_display = ["name", "priority", "difficulty", "created", "done"]
@dator-zz
dator-zz / gist:630713
Created October 17, 2010 10:08
Result in terminal
sfapp% php app/console doctrine:data:load
PHP Fatal error: Class 'Doctrine\Common\DataFixtures\Loader' not found in /Users/clement/Sites/sfapp/src/vendor/symfony/src/Symfony/Bundle/DoctrineBundle/Command/LoadDataFixturesDoctrineCommand.php on line 82
<?php
namespace Application\YourBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpKernel\Exception\FlattenException;
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
class ExceptionController extends Controller
{
/**
<?php
namespace Application\DoctrineUserBundle\Entity;
use Bundle\DoctrineUserBundle\Entity\User as BaseUser;
/**
* @orm:Entity(repositoryClass="Application\DoctrineUserBundle\Entity\UserRepository")
* @orm:HasLifecycleCallbacks
*/
class User extends BaseUser
<?php
/* I have to table, one user table and one company table.
An user belongs to a company (and a company has many users) .
In the user form, i have the embed form for company.
*/
class myGuardRegisterForm extends BasesfGuardRegisterForm
{
/**
* @see sfForm
@dator-zz
dator-zz / gist:758389
Created December 29, 2010 10:12
textmate snippet, Symfony2 entities/documents getter/setter
/**
* Set $1
* @return null
*/
public function set${1/./\u$0/}(\$$1)
{
\$this->${1/./\l$0/} = \$${1/./\l$0/};
}
/**
@dator-zz
dator-zz / Company.php
Created December 29, 2010 12:17
Custom user form for UserBundle
<?php
namespace Application\MyBundle\Document;
use Application\FOS\UserBundle\Model\User;
/**
* @mongodb:Document(
* collection="company",
* repositoryClass="Application\MyBundle\Document\CompanyRepository"
@dator-zz
dator-zz / gist:769463
Created January 7, 2011 13:45
Git command to show an ordered list of a repository contributors
git log --pretty=format:%aN | sort | uniq -c | sort -rn
I tried to run :
php app/console doctrine:database:drop
But i get this error:
[InvalidArgumentException]
Could not find any configured connections
Here is my configuration( DBAL )