Skip to main content

Home/ foograde/ Group items tagged relation

Rss Feed Group items tagged

federico balderas

Symfony - Doctrine - Saving Many-To-Many (M:M) relationships | Me Like Dev - 0 views

  •  
    "01 Author: 02 tableName: author 03 columns: 04 ... 05 relations: 06 Book: 07 class: Book 08 refClass: LinkingAuthorBook #This will allow you to reference Book rows from an Author object 09 local: author_id #Local value refers to the current object, in this case Author 10 foreign: book_id #Foreign value refers to the object you wish to link to from Author, in this case Book 11 Book: 12 tableName: book 13 columns: 14 ... 15 relations: 16 Author: 17 class: Author 18 refClass: LinkingAuthorBook #This will allow you to reference Author rows from a Book object 19 local: book_id #Local value refers to the current object, in this case Author 20 foreign: author_id #Foreign value refers to the object you wish to link to from Book, in this case Author"
Adán Muguiro

Modificando los widgets en la acción - 0 views

  • // in modules/foo/actions/actions.class.php // Define the form $this->form = new ContactForm();   // Add an empty option to the list of choices of a 'choice' widget $form->getWidget('language')->setOption('add_empty', 'Please choose a language'); // Add a 'gender' list of options widget $form->setWidget('gender', new sfWidgetFormChoice(array('expanded' => true, 'choices' => array('m' => 'Male', 'f' => 'Female')), array('class' => 'gender_list'))); // Change the HTML attributes of the 'subject' widget $form->getWidget('subject')->setAttribute('disabled', 'disabled'); // Remove the 'subject' field unset($form['subject']) // Note: You cannot remove just the widget. Removing a widget will also remove the related validators   // Change the 'min_length' error in the 'message' validator $form->getValidator('message')->setMessage('min_length', 'Message too short'); // Make the 'name' field optional $form->getValidator('name')->setOption('required', false);
  •  
    Varias cosas que se pueden modificar en los widgets desde la acción.
Adán Muguiro

Doctrine NestedSet - 0 views

  • $treeObject = Doctrine_Core::getTable('Category')->getTree(); $rootColumnName = $treeObject->getAttribute('rootColumnName'); foreach ($treeObject->fetchRoots() as $root) { $options = array( 'root_id' => $root->$rootColumnName ); foreach($treeObject->fetchTree($options) as $node) { echo str_repeat(' ', $node['level']) . $node['name'] . "\n"; } }
    • Fernando Vega
       
      fetch para deplegar nodos padres e hijos con doctrine
  • First lets create the query we want to use to retrieve our tree data with: // test.php // ... $q = Doctrine_Query::create() ->select('c.name, p.name, m.name') ->from('Category c') ->leftJoin('c.HottestProduct p') ->leftJoin('p.Manufacturer m'); Now we need to set the above query as the base query for the tree: $treeObject = Doctrine_Core::getTable('Category')->getTree(); $treeObject->setBaseQuery($q); $tree = $treeObject->fetchTree(); There it is, the tree with all the related data you need, all in one query.
  •  
    Agregar una subconsulta a un objeto NestedSet
1 - 3 of 3
Showing 20 items per page