PageRenderTime 81ms CodeModel.GetById 40ms app.highlight 2ms RepoModel.GetById 38ms app.codeStats 0ms

/Library/Kumbia/ActiveRecord/Generator/Strategies/Uniqid.php

http://kumbia-enterprise.googlecode.com/
PHP | 99 lines | 19 code | 13 blank | 67 comment | 0 complexity | 6d35a9d048a35134956be200d6acebe2 MD5 | raw file
 1<?php
 2
 3/**
 4 * Kumbia Enterprise Framework
 5 *
 6 * LICENSE
 7 *
 8 * This source file is subject to the New BSD License that is bundled
 9 * with this package in the file docs/LICENSE.txt.
10 *
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@loudertechnology.com so we can send you a copy immediately.
14 *
15 * @category	Kumbia
16 * @package		ActiveRecord
17 * @subpackage	Generator
18 * @copyright	Copyright (c) 2008-2009 Louder Technology COL. (http://www.loudertechnology.com)
19 * @copyright	Copyright (c) 2008-2009 Andres Felipe Gutierrez (gutierrezandresfelipe at gmail.com)
20 * @license		New BSD License
21 * @version 	$Id: Uniqid.php 5 2009-04-24 01:48:48Z gutierrezandresfelipe $
22 */
23
24/**
25 * UniqIdGenerator
26 *
27 * Genera identificadores a partir de Uniqid
28 *
29 * @category	Kumbia
30 * @package		ActiveRecord
31 * @subpackage	Generator
32 * @copyright	Copyright (c) 2008-2009 Louder Technology COL. (http://www.loudertechnology.com)
33 * @copyright	Copyright (c) 2008-2009 Andres Felipe Gutierrez (gutierrezandresfelipe at gmail.com)
34 * @license		New BSD License
35 * @link 		http://www.php.net/uniqid
36 * @link 		http://en.wikipedia.org/wiki/UUID
37 */
38class UuidGenerator implements ActiveRecordGeneratorInterface {
39
40	/**
41	 * UniqId generado
42	 *
43	 * @var string
44	 */
45	protected $_uniqid;
46
47	/**
48	 * Constructor de UuidGenerator
49	 *
50	 */
51	public function __construct(){
52		$this->_uniqid = md5(uniqid(mt_rand(), true));
53	}
54
55	/**
56	 * Establece las opciones del generador
57	 *
58	 * @param array $options
59	 */
60	public function setOptions($options){
61
62	}
63
64	/**
65	 * Establece el nombre de la columna identidad
66	 *
67	 * @param string $identityColumn
68	 */
69	public function setIdentityColumn($identityColumn){
70		$this->_identityColumn = $identityColumn;
71	}
72
73	/**
74	 * Objeto que solicita el identificador
75	 *
76	 * @param ActiveRecord $record
77	 */
78	public function setIdentifier($record){
79		$record->writeAttribute($this->_identityColumn, $this->_uniqid);
80	}
81
82	/**
83	 * Actualiza el consecutivo
84	 *
85	 * @return boolean
86	 */
87	public function updateConsecutive($record){
88
89	}
90
91	/**
92	 * Finaliza el generador
93	 *
94	 */
95	public function finalizeConsecutive(){
96
97	}
98
99}