Skip to content

Instantly share code, notes, and snippets.

@mavimo
Created October 29, 2010 15:32
Show Gist options
  • Save mavimo/653762 to your computer and use it in GitHub Desktop.
Save mavimo/653762 to your computer and use it in GitHub Desktop.
Schema del DB (due entità, A e B)
<?php
/**
* BTable
*
* This class has been auto-generated by the Doctrine ORM Framework
*/
class BTable extends Doctrine_Table
{
/**
* Returns an instance of this class.
*
* @return object BTable
*/
public static function getInstance()
{
return Doctrine_Core::getTable('B');
}
/**
* Parte aggiunta
*/
function construct()
{
// Imposto il criterio di sorting.
$this->setOption('orderBy', 'sorting ASC');
}
}
# Entity A
A:
columns:
name: string(255)
relations:
Bs:
type: many
class: B
local: id
foreign: a_id
onDelete: CASCADE
# Entity B
B:
columns:
a_id: integer
name: string(255)
sorting: integer
relations:
A:
local: a_id
foreign: id
type: one
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment