We have a new blog over at
http://it.blog.adclick.pt
http://it.blog.adclick.pt
All posts from this blog were transferred.
Hope to see you there!
Dicas sobre a framework Symfony
public function getAverageRating() { $c = new Criteria; $c->addSelectColumn('avg(' . RatingPeer::RATING . ')'); $c->add(RatingPeer::ID, $this->getId()); $stmt = RatingPeer::doSelectStmt($c); $average = $stmt->fetchAll(PDO::FETCH_COLUMN); if(array_key_exists(0, $average)) { return floatval($average[0]); } else { return 0; } }
dev: logger: param: loggers: sf_web_debug: param: xdebug_logging: true
Symfony Nosso que estais no svn,Décio @ Yammer
santificado seja o vosso php,
vem a nós o vosso MVC,
seja feita a vossa aplicação
assim na terra como na web.
A cache nossa de cada dia nos daí hoje,
perdoai-nos os nossos bugs,
assim como nós perdoamos
ao Ti Nano,
não nos deixei cair em tentação
mas livrai-nos do Ruby.
Amém.
$category = 'Pastéis de Nata'; $url = Doctrine_Inflector::urlize($category); echo $url;
pasteis-de-nata
class YourFormFilter extends BaseYourFormFilter { public function setup() { // ... $context = sfContext::getInstance(); /* @var $context sfContext */ $request = $context->getRequest(); /* @var $request sfWebRequest */ $user = $context->getUser(); /* @var $user sfBasicSecurityUser */ if ($user->hasCredential('credential_to_check')) { $this->setWidget('your_field', new sfWidgetFormFilterInput()); $this->setValidator('your_field', new sfValidatorPass(array('required' => false))); $this->widgetSchema->moveField('your_field', sfWidgetFormSchema::AFTER, 'other_field'); // this is good to re-arrange the filters order } } // ...
propel: _attributes: { package: plugins.sfGuardPlugin.lib.model } ## # extending sfGuard ## sf_guard_user: _attributes: { phpName: sfGuardUser } coisas: { type: varchar, size: 128, required: true }
php symfony propel:build --all-classes
You may also use Doctrine extensions:
Finally, there are also symfony plugins providing custom behaviors:
_componentName: enabled: false
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 71 bytes) in /blablabla/lib/vendor/symfony/lib/log/sfVarLogger.class.php on line 170
task: symfony: param: profiler: false all: symfony: class: sfDoctrineDatabase param: dsn: .... username: ... password: ...
$this->getRequest()->getParameterHolder()->getAll();
As of version 5.2.5, PHP is not able to garbage collect object graphs that have circular references, e.g. Parent has a reference to Child which has a reference to Parent. Since many doctrine model objects have such relations, PHP will not free their memory even when the objects go out of scope.
$meu_objecto->free();
unset($meu_objecto);
//memory check
$memOld = $memNow;
$memNow = memory_get_usage();
$this->log('Memory usage: ' . $memNow . ' (diff=' . ($memNow - $memOld) . ')';