kumbia-enterprise /Library/Kumbia/ActiveRecord/Generator/Strategies/Uniqid.php

Language PHP Lines 100
MD5 Hash 6d35a9d048a35134956be200d6acebe2 Estimated Cost $398 (why?)
Repository http://kumbia-enterprise.googlecode.com/svn/trunk/ View Raw File
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php

/**
 * Kumbia Enterprise Framework
 *
 * LICENSE
 *
 * This source file is subject to the New BSD License that is bundled
 * with this package in the file docs/LICENSE.txt.
 *
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@loudertechnology.com so we can send you a copy immediately.
 *
 * @category	Kumbia
 * @package		ActiveRecord
 * @subpackage	Generator
 * @copyright	Copyright (c) 2008-2009 Louder Technology COL. (http://www.loudertechnology.com)
 * @copyright	Copyright (c) 2008-2009 Andres Felipe Gutierrez (gutierrezandresfelipe at gmail.com)
 * @license		New BSD License
 * @version 	$Id: Uniqid.php 5 2009-04-24 01:48:48Z gutierrezandresfelipe $
 */

/**
 * UniqIdGenerator
 *
 * Genera identificadores a partir de Uniqid
 *
 * @category	Kumbia
 * @package		ActiveRecord
 * @subpackage	Generator
 * @copyright	Copyright (c) 2008-2009 Louder Technology COL. (http://www.loudertechnology.com)
 * @copyright	Copyright (c) 2008-2009 Andres Felipe Gutierrez (gutierrezandresfelipe at gmail.com)
 * @license		New BSD License
 * @link 		http://www.php.net/uniqid
 * @link 		http://en.wikipedia.org/wiki/UUID
 */
class UuidGenerator implements ActiveRecordGeneratorInterface {

	/**
	 * UniqId generado
	 *
	 * @var string
	 */
	protected $_uniqid;

	/**
	 * Constructor de UuidGenerator
	 *
	 */
	public function __construct(){
		$this->_uniqid = md5(uniqid(mt_rand(), true));
	}

	/**
	 * Establece las opciones del generador
	 *
	 * @param array $options
	 */
	public function setOptions($options){

	}

	/**
	 * Establece el nombre de la columna identidad
	 *
	 * @param string $identityColumn
	 */
	public function setIdentityColumn($identityColumn){
		$this->_identityColumn = $identityColumn;
	}

	/**
	 * Objeto que solicita el identificador
	 *
	 * @param ActiveRecord $record
	 */
	public function setIdentifier($record){
		$record->writeAttribute($this->_identityColumn, $this->_uniqid);
	}

	/**
	 * Actualiza el consecutivo
	 *
	 * @return boolean
	 */
	public function updateConsecutive($record){

	}

	/**
	 * Finaliza el generador
	 *
	 */
	public function finalizeConsecutive(){

	}

}
Back to Top