1: <?php
2:
3: namespace cli_db;
4:
5: require_once ROOT . 'classes/AbstractTable.php';
6:
7: class Contact extends AbstractTable {
8:
9: 10: 11:
12: public static function getKeys() {
13: return array(
14: 'id' => array(
15: 'colname' => 'ContactId',
16: 'actions' => array(
17: 'details' => 'required',
18: 'update' => 'required',
19: 'delete' => 'required',
20: ),
21: 'description' => 'contact id'
22: ),
23: 'name' => array(
24: 'colname' => 'Name',
25: 'actions' => array(
26: 'insert' => 'required',
27: 'update' => 'optional',
28: ),
29: 'description' => 'name (unique)'
30: ),
31: 'description' => array(
32: 'colname' => 'Description',
33: 'actions' => array(
34: 'insert' => 'optional',
35: 'update' => 'optional',
36: ),
37: 'description' => 'description'
38: ),
39: );
40: }
41:
42: 43: 44:
45: public static function CLI_commandDescription() {
46: return 'Manipulate contacts.';
47: }
48:
49: 50: 51:
52: public static function CLI_commandName() {
53: return 'contact';
54: }
55:
56: 57: 58:
59: public static function CLI_longHelp() {
60:
61: }
62:
63: 64: 65:
66: public static function getSubCommands() {
67: return array('insert', 'update', 'delete', 'details', 'list');
68: }
69:
70: 71: 72: 73:
74: protected static function command_details($options, $keys) {
75: parent::command_details($options, $keys);
76:
77: $q = new \cli_db\propel\ContactQuery();
78: $contact = $q->findOneByContactId($options['id']);
79:
80: $references = array();
81: foreach ($contact->getBiomaterials() as $biomat) {
82: $references[] = array('Biomaterial', sprintf("Id: %s\nName: %s", $biomat->getBiomaterialId(), $biomat->getName()));
83: }
84: foreach ($contact->getAssays() as $assay) {
85: $references[] = array('Assay', sprintf("Id: %s\nName: %s", $assay->getAssayId(), $assay->getName()));
86: }
87: foreach ($contact->getQuantifications() as $assay) {
88: $references[] = array('Quantification', sprintf("Id: %s\nName: %s", $assay->getQuantificationId(), $assay->getName()));
89: }
90: if (count($references) > 0) {
91: print "referenced by other tables:\n";
92: self::printTable(array('Table', 'Row'), $references);
93: }
94: }
95:
96: 97: 98:
99: public static function getPropelClass() {
100: return '\\cli_db\\propel\\Contact';
101: }
102:
103: }
104:
105: ?>
106: