Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am jmather on github.
  • I am thejmather (https://keybase.io/thejmather) on keybase.
  • I have a public key whose fingerprint is 398D AEDD 8EA9 DC5A 1F2B 4E1B 8494 4ADB 482B B934

To claim this, I am signing this object:

@jmather
jmather / majaxMediaRegistryEntryEmbeddedForm.class.php
Created Jan 29, 2011
Example of how to prepare a form for embedding
View majaxMediaRegistryEntryEmbeddedForm.class.php
public function configure()
{
parent::configure();
unset($this['id']);
unset($this['uuid'], $this['video_media'], $this['audio_media'], $this['photo_media'], $this['gallery_media']);
unset($this['created_at'], $this['updated_at']);
$gal_widget_opts = array('multiple' => true, 'model' => 'majaxMediaGallery');
if ($this->getObject()->getType() == 'Gallery')
{
$gal_widget_opts['exclude'] = $this->getObject()->getObject()->id;
@jmather
jmather / majaxMediaRegistryEntryEmbeddedForm.class.php
Created Jan 29, 2011
How to trick embedded forms into thinking they are bound
View majaxMediaRegistryEntryEmbeddedForm.class.php
public function isValid()
{
return true;
}
public function processValues($values)
{
$this->values = parent::processValues($values);
$this->isBound = true;
return $this->values;
}
@jmather
jmather / majaxMediaRegistryEntryEmbeddedForm.class.php
Created Jan 29, 2011
How to force a many-to-many relationship to be saved by overriding saveEmbeddedForms
View majaxMediaRegistryEntryEmbeddedForm.class.php
public function saveEmbeddedForms($con = null, $forms = null)
{
$this->saveGalleriesList($con);
parent::saveEmbeddedForms($con, $forms);
}
@jmather
jmather / ExampleForm.class.php
Created Jan 29, 2011
How you can post validate embedded forms
View ExampleForm.class.php
class TestForm
{
public function configure()
{
// ... snip ...
$eForm = new SomeObjectEmbeddedForm($this->getObject()->SomeObject);
$this->embedForm('some_object', $eForm);
$this->validatorSchema->setPostValidator(
@jmather
jmather / PluginmajaxMediaVideoForm.class.php
Created Jan 29, 2011
How to use embedded media registry form
View PluginmajaxMediaVideoForm.class.php
$f = new majaxMediaRegistryEntryEmbeddedForm($this->getObject()->MediaRegistryEntry);
$f->updateDefaultsFromObject();
$this->embedMergeForm('media', $f);
View gist:831826
public function configureDoctrine(Doctrine_Manager $manager)
{
$options = array('baseClassName' => 'myDoctrineRecord');
sfConfig::set('doctrine_model_builder_options', $options);
}
@jmather
jmather / httpd.conf
Created Mar 3, 2011
The chunk you need to ensure is in there for .htaccess files to work
View httpd.conf
<Directory "/www">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
@jmather
jmather / ProjectConfiguration.class.php
Created Mar 3, 2011
How to enable identifier quoting with Doctrine in symfony
View ProjectConfiguration.class.php
<?php
class ProjectConfiguration extends sfProjectConfiguration
{
// ...
public function configureDoctrine(Doctrine_Manager $manager)
{
$manager->setAttribute(Doctrine_Core::ATTR_QUOTE_IDENTIFIER, true);
}
View gist:866988
$this->executor->setExecutable($ffmpeg);
$this->executor->setArguments($args);
$this->executor->execute();