@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | class TActiveMultiView extends TMultiView implements IActiveControl |
31 | 31 | { |
32 | 32 | /** |
33 | - * Creates a new callback control, sets the adapter to |
|
34 | - * TActiveControlAdapter. |
|
35 | - */ |
|
33 | + * Creates a new callback control, sets the adapter to |
|
34 | + * TActiveControlAdapter. |
|
35 | + */ |
|
36 | 36 | public function __construct() |
37 | 37 | { |
38 | 38 | parent::__construct(); |
@@ -40,28 +40,28 @@ discard block |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
43 | - * @return TBaseActiveControl standard active control options. |
|
44 | - */ |
|
43 | + * @return TBaseActiveControl standard active control options. |
|
44 | + */ |
|
45 | 45 | public function getActiveControl() |
46 | 46 | { |
47 | 47 | return $this->getAdapter()->getBaseActiveControl(); |
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
51 | - * Returns the id of the surrounding container (span). |
|
52 | - * @return string container id |
|
53 | - */ |
|
51 | + * Returns the id of the surrounding container (span). |
|
52 | + * @return string container id |
|
53 | + */ |
|
54 | 54 | protected function getContainerID() |
55 | 55 | { |
56 | 56 | return $this->ClientID.'_Container'; |
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
60 | - * Renders the TActiveMultiView. |
|
61 | - * If the MutliView did not pass the prerender phase yet, it will register itself for rendering later. |
|
62 | - * Else it will call the {@link renderMultiView()} method which will do the rendering of the MultiView. |
|
63 | - * @param THtmlWriter writer for the rendering purpose |
|
64 | - */ |
|
60 | + * Renders the TActiveMultiView. |
|
61 | + * If the MutliView did not pass the prerender phase yet, it will register itself for rendering later. |
|
62 | + * Else it will call the {@link renderMultiView()} method which will do the rendering of the MultiView. |
|
63 | + * @param THtmlWriter writer for the rendering purpose |
|
64 | + */ |
|
65 | 65 | public function render($writer) |
66 | 66 | { |
67 | 67 | if($this->getHasPreRendered()) { |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
77 | - * Renders the TActiveMultiView by writing a span tag with the container id obtained from {@link getContainerID()} |
|
78 | - * which will be called by the replacement method of the client script to update it's content. |
|
79 | - * @param $writer THtmlWriter writer for the rendering purpose |
|
80 | - */ |
|
77 | + * Renders the TActiveMultiView by writing a span tag with the container id obtained from {@link getContainerID()} |
|
78 | + * which will be called by the replacement method of the client script to update it's content. |
|
79 | + * @param $writer THtmlWriter writer for the rendering purpose |
|
80 | + */ |
|
81 | 81 | protected function renderMultiView($writer) |
82 | 82 | { |
83 | 83 | $writer->addAttribute('id', $this->getContainerID()); |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
90 | - * @param integer the zero-based index of the current view in the view collection. -1 if no active view. |
|
91 | - * @throws TInvalidDataValueException if the view index is invalid |
|
92 | - */ |
|
90 | + * @param integer the zero-based index of the current view in the view collection. -1 if no active view. |
|
91 | + * @throws TInvalidDataValueException if the view index is invalid |
|
92 | + */ |
|
93 | 93 | public function setActiveViewIndex($value) |
94 | 94 | { |
95 | 95 | $old=parent::getActiveViewIndex(); |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
102 | - * @param TView the view to be activated |
|
103 | - * @throws TInvalidOperationException if the view is not in the view collection |
|
104 | - */ |
|
102 | + * @param TView the view to be activated |
|
103 | + * @throws TInvalidOperationException if the view is not in the view collection |
|
104 | + */ |
|
105 | 105 | public function setActiveView($value) |
106 | 106 | { |
107 | 107 | $old=parent::getActiveView(); |
@@ -58,8 +58,7 @@ |
||
58 | 58 | if ($this->sourcepath === NULL) |
59 | 59 | { |
60 | 60 | $this->sourcepath = $sourcepath; |
61 | - } |
|
62 | - else |
|
61 | + } else |
|
63 | 62 | { |
64 | 63 | $this->sourcepath->append($sourcepath); |
65 | 64 | } |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | if($this->getHasPreRendered()) { |
68 | 68 | $this->renderMultiView($writer); |
69 | 69 | if($this->getActiveControl()->canUpdateClientSide()) |
70 | - $this->getPage()->getCallbackClient()->replaceContent($this->getContainerID(),$writer); |
|
70 | + $this->getPage()->getCallbackClient()->replaceContent($this->getContainerID(), $writer); |
|
71 | 71 | } |
72 | 72 | else |
73 | - $this->getPage()->getAdapter()->registerControlToRender($this,$writer); |
|
73 | + $this->getPage()->getAdapter()->registerControlToRender($this, $writer); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $old=parent::getActiveViewIndex(); |
96 | 96 | parent::setActiveViewIndex($value); |
97 | 97 | if($this->getActiveControl()->canUpdateClientSide() && $old!=$value) |
98 | - $this->getPage()->getAdapter()->registerControlToRender($this,$this->getResponse()->createHtmlWriter()); |
|
98 | + $this->getPage()->getAdapter()->registerControlToRender($this, $this->getResponse()->createHtmlWriter()); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -107,6 +107,6 @@ discard block |
||
107 | 107 | $old=parent::getActiveView(); |
108 | 108 | parent::setActiveView($value); |
109 | 109 | if($this->getActiveControl()->canUpdateClientSide() && $old!=$value) |
110 | - $this->getPage()->getAdapter()->registerControlToRender($this,$this->getResponse()->createHtmlWriter()); |
|
110 | + $this->getPage()->getAdapter()->registerControlToRender($this, $this->getResponse()->createHtmlWriter()); |
|
111 | 111 | } |
112 | 112 | } |
@@ -32,8 +32,8 @@ |
||
32 | 32 | |
33 | 33 | /** |
34 | 34 | * @return boolean a value indicating whether an automatic postback to the server |
35 | - * will occur whenever the user modifies the text in the TActiveDatePicker control and |
|
36 | - * then tabs out of the component. Defaults to true. |
|
35 | + * will occur whenever the user modifies the text in the TActiveDatePicker control and |
|
36 | + * then tabs out of the component. Defaults to true. |
|
37 | 37 | */ |
38 | 38 | public function getAutoPostBack() |
39 | 39 | { |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function getAutoPostBack() |
39 | 39 | { |
40 | - return $this->getViewState('AutoPostBack',true); |
|
40 | + return $this->getViewState('AutoPostBack', true); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function setAutoPostBack($value) |
50 | 50 | { |
51 | - $this->setViewState('AutoPostBack',TPropertyValue::ensureBoolean($value),true); |
|
51 | + $this->setViewState('AutoPostBack', TPropertyValue::ensureBoolean($value), true); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -57,12 +57,12 @@ discard block |
||
57 | 57 | */ |
58 | 58 | protected function getDatePickerOptions() |
59 | 59 | { |
60 | - $options = parent::getDatePickerOptions(); |
|
60 | + $options=parent::getDatePickerOptions(); |
|
61 | 61 | $options['CausesValidation']=$this->getCausesValidation(); |
62 | 62 | $options['ValidationGroup']=$this->getValidationGroup(); |
63 | - $options['EventTarget'] = $this->getUniqueID(); |
|
64 | - $options['ShowCalendar'] = $this->getShowCalendar(); |
|
65 | - $options['AutoPostBack'] = $this->getAutoPostBack(); |
|
63 | + $options['EventTarget']=$this->getUniqueID(); |
|
64 | + $options['ShowCalendar']=$this->getShowCalendar(); |
|
65 | + $options['AutoPostBack']=$this->getAutoPostBack(); |
|
66 | 66 | return $options; |
67 | 67 | } |
68 | 68 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | /** |
81 | 81 | * @return TBaseActiveCallbackControl standard callback control options. |
82 | 82 | */ |
83 | - public function getActiveControl(){ |
|
83 | + public function getActiveControl() { |
|
84 | 84 | return $this->getAdapter()->getBaseActiveControl(); |
85 | 85 | } |
86 | 86 | |
@@ -88,21 +88,21 @@ discard block |
||
88 | 88 | * Client-side Text property can only be updated after the OnLoad stage. |
89 | 89 | * @param string text content for the textbox |
90 | 90 | */ |
91 | - public function setText($value){ |
|
92 | - if(parent::getText() === $value) |
|
91 | + public function setText($value) { |
|
92 | + if(parent::getText()===$value) |
|
93 | 93 | return; |
94 | 94 | |
95 | 95 | parent::setText($value); |
96 | - if($this->getActiveControl()->canUpdateClientSide() && $this->getHasLoadedPostData()){ |
|
96 | + if($this->getActiveControl()->canUpdateClientSide() && $this->getHasLoadedPostData()) { |
|
97 | 97 | $cb=$this->getPage()->getCallbackClient(); |
98 | 98 | $cb->setValue($this, $value); |
99 | - if ($this->getInputMode()==TDatePickerInputMode::DropDownList) |
|
99 | + if($this->getInputMode()==TDatePickerInputMode::DropDownList) |
|
100 | 100 | { |
101 | - $s = Prado::createComponent('System.Util.TDateTimeStamp'); |
|
102 | - $date = $s->getDate($this->getTimeStampFromText()); |
|
101 | + $s=Prado::createComponent('System.Util.TDateTimeStamp'); |
|
102 | + $date=$s->getDate($this->getTimeStampFromText()); |
|
103 | 103 | $id=$this->getClientID(); |
104 | 104 | $cb->select($id.TControl::CLIENT_ID_SEPARATOR.'day', 'Value', $date['mday'], 'select'); |
105 | - $cb->select($id.TControl::CLIENT_ID_SEPARATOR.'month', 'Value', $date['mon']-1, 'select'); |
|
105 | + $cb->select($id.TControl::CLIENT_ID_SEPARATOR.'month', 'Value', $date['mon'] - 1, 'select'); |
|
106 | 106 | $cb->select($id.TControl::CLIENT_ID_SEPARATOR.'year', 'Value', $date['year'], 'select'); |
107 | 107 | |
108 | 108 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * This method is mainly used by framework and control developers. |
116 | 116 | * @param TCallbackEventParameter the event parameter |
117 | 117 | */ |
118 | - public function raiseCallbackEvent($param){ |
|
118 | + public function raiseCallbackEvent($param) { |
|
119 | 119 | $this->onCallback($param); |
120 | 120 | } |
121 | 121 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * handler can be invoked. |
127 | 127 | * @param TCallbackEventParameter event parameter to be passed to the event handlers |
128 | 128 | */ |
129 | - public function onCallback($param){ |
|
129 | + public function onCallback($param) { |
|
130 | 130 | $this->raiseEvent('OnCallback', $this, $param); |
131 | 131 | } |
132 | 132 | |
@@ -136,22 +136,22 @@ discard block |
||
136 | 136 | |
137 | 137 | protected function registerCalendarClientScriptPre() |
138 | 138 | { |
139 | - $cs = $this->getPage()->getClientScript(); |
|
139 | + $cs=$this->getPage()->getClientScript(); |
|
140 | 140 | $cs->registerPradoScript("activedatepicker"); |
141 | 141 | } |
142 | 142 | |
143 | 143 | protected function renderClientControlScript($writer) |
144 | 144 | { |
145 | - $cs = $this->getPage()->getClientScript(); |
|
145 | + $cs=$this->getPage()->getClientScript(); |
|
146 | 146 | if(!$cs->isEndScriptRegistered('TDatePicker.spacer')) |
147 | 147 | { |
148 | - $spacer = $this->getAssetUrl('spacer.gif'); |
|
149 | - $code = "Prado.WebUI.TDatePicker.spacer = '$spacer';"; |
|
148 | + $spacer=$this->getAssetUrl('spacer.gif'); |
|
149 | + $code="Prado.WebUI.TDatePicker.spacer = '$spacer';"; |
|
150 | 150 | $cs->registerEndScript('TDatePicker.spacer', $code); |
151 | 151 | } |
152 | 152 | |
153 | - $options = TJavaScript::encode($this->getDatePickerOptions()); |
|
154 | - $code = "new Prado.WebUI.TActiveDatePicker($options);"; |
|
153 | + $options=TJavaScript::encode($this->getDatePickerOptions()); |
|
154 | + $code="new Prado.WebUI.TActiveDatePicker($options);"; |
|
155 | 155 | $cs->registerEndScript("prado:".$this->getClientID(), $code); |
156 | 156 | } |
157 | 157 |
@@ -22,7 +22,7 @@ |
||
22 | 22 | */ |
23 | 23 | class TActiveHiddenField extends THiddenField implements ICallbackEventHandler, IActiveControl |
24 | 24 | { |
25 | - /** |
|
25 | + /** |
|
26 | 26 | * Creates a new callback control, sets the adapter to |
27 | 27 | * TActiveControlAdapter. If you override this class, be sure to set the |
28 | 28 | * adapter appropriately by, for example, by calling this constructor. |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function setValue($value) |
57 | 57 | { |
58 | - if(parent::getValue() === $value) |
|
58 | + if(parent::getValue()===$value) |
|
59 | 59 | return; |
60 | 60 | |
61 | 61 | parent::setValue($value); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | protected function addAttributesToRender($writer) |
112 | 112 | { |
113 | 113 | parent::addAttributesToRender($writer); |
114 | - $writer->addAttribute('id',$this->getClientID()); |
|
114 | + $writer->addAttribute('id', $this->getClientID()); |
|
115 | 115 | $this->getActiveControl()->registerCallbackClientScript( |
116 | 116 | $this->getClientClassName(), $this->getPostBackOptions()); |
117 | 117 | } |
@@ -60,8 +60,8 @@ |
||
60 | 60 | * @param THtmlWriter the writer used for the rendering purpose |
61 | 61 | */ |
62 | 62 | protected function addAttributesToRender($writer) { |
63 | - $writer->addAttribute('id',$this->getClientID()); |
|
64 | - parent::addAttributesToRender($writer); |
|
63 | + $writer->addAttribute('id',$this->getClientID()); |
|
64 | + parent::addAttributesToRender($writer); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -58,8 +58,7 @@ |
||
58 | 58 | if ($this->sourcepath === NULL) |
59 | 59 | { |
60 | 60 | $this->sourcepath = $sourcepath; |
61 | - } |
|
62 | - else |
|
61 | + } else |
|
63 | 62 | { |
64 | 63 | $this->sourcepath->append($sourcepath); |
65 | 64 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @param THtmlWriter the writer used for the rendering purpose |
61 | 61 | */ |
62 | 62 | protected function addAttributesToRender($writer) { |
63 | - $writer->addAttribute('id',$this->getClientID()); |
|
63 | + $writer->addAttribute('id', $this->getClientID()); |
|
64 | 64 | parent::addAttributesToRender($writer); |
65 | 65 | } |
66 | 66 | |
@@ -77,17 +77,17 @@ discard block |
||
77 | 77 | { |
78 | 78 | parent::render($writer); |
79 | 79 | if($this->getActiveControl()->canUpdateClientSide()) |
80 | - $this->getPage()->getCallbackClient()->replaceContent($this,$writer); |
|
80 | + $this->getPage()->getCallbackClient()->replaceContent($this, $writer); |
|
81 | 81 | } |
82 | 82 | else |
83 | 83 | { |
84 | - $this->getPage()->getAdapter()->registerControlToRender($this,$writer); |
|
85 | - if ($this->getHasControls()) |
|
84 | + $this->getPage()->getAdapter()->registerControlToRender($this, $writer); |
|
85 | + if($this->getHasControls()) |
|
86 | 86 | { |
87 | 87 | // If we update a TActivePanel on callback, |
88 | 88 | // We shouldn't update all childs, because the whole content will be replaced by |
89 | 89 | // the parent |
90 | - foreach ($this->findControlsByType('IActiveControl', false) as $control) |
|
90 | + foreach($this->findControlsByType('IActiveControl', false) as $control) |
|
91 | 91 | { |
92 | 92 | $control->getActiveControl()->setEnableUpdate(false); |
93 | 93 | } |
@@ -116,7 +116,7 @@ |
||
116 | 116 | && $this->getPage()->getClientSupportsJavaScript()) |
117 | 117 | { |
118 | 118 | $this->getActiveControl()->registerCallbackClientScript( |
119 | - $this->getClientClassName(), $this->getPostBackOptions()); |
|
119 | + $this->getClientClassName(), $this->getPostBackOptions()); |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * updated later. |
69 | 69 | *@return boolean always true |
70 | 70 | */ |
71 | - protected function getSpanNeeded () |
|
71 | + protected function getSpanNeeded() |
|
72 | 72 | { |
73 | 73 | return true; |
74 | 74 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | protected function createRepeatedControl() |
89 | 89 | { |
90 | - $control = new TActiveCheckBoxListItem; |
|
90 | + $control=new TActiveCheckBoxListItem; |
|
91 | 91 | $control->getAdapter()->setBaseActiveControl($this->getActiveControl()); |
92 | 92 | return $control; |
93 | 93 | } |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | * @param string checkbox id |
152 | 152 | * @param string onclick js |
153 | 153 | */ |
154 | - protected function renderInputTag($writer,$clientID,$onclick) |
|
154 | + protected function renderInputTag($writer, $clientID, $onclick) |
|
155 | 155 | { |
156 | - TCheckBox::renderInputTag($writer,$clientID,$onclick); |
|
156 | + TCheckBox::renderInputTag($writer, $clientID, $onclick); |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | * It reads the CacheModule property. |
51 | 51 | * @param TXmlElement module configuration |
52 | 52 | */ |
53 | - public function init($config) |
|
54 | - { |
|
53 | + public function init($config) |
|
54 | + { |
|
55 | 55 | if($this->_cacheModuleID==='') |
56 | 56 | throw new TConfigurationException('cachesession_cachemoduleid_required'); |
57 | 57 | else if(($cache=$this->getApplication()->getModule($this->_cacheModuleID))===null) |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | throw new TConfigurationException('cachesession_cachemodule_invalid',$this->_cacheModuleID); |
63 | 63 | $this->setUseCustomStorage(true); |
64 | 64 | parent::init($config); |
65 | - } |
|
65 | + } |
|
66 | 66 | |
67 | 67 | /** |
68 | 68 | * @return string the ID of the cache module. |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function _read($id) |
97 | 97 | { |
98 | - return $this->_cache->get($this->calculateKey($id)); |
|
98 | + return $this->_cache->get($this->calculateKey($id)); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function _destroy($id) |
119 | 119 | { |
120 | - return $this->_cache->delete($this->calculateKey($id)); |
|
120 | + return $this->_cache->delete($this->calculateKey($id)); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -125,15 +125,15 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public function getKeyPrefix() |
127 | 127 | { |
128 | - return $this->_prefix; |
|
128 | + return $this->_prefix; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
132 | - * @param string prefix of session variable name to avoid conflict with other cache data |
|
133 | - */ |
|
132 | + * @param string prefix of session variable name to avoid conflict with other cache data |
|
133 | + */ |
|
134 | 134 | public function setKeyPrefix($value) |
135 | 135 | { |
136 | - $this->_prefix=$value; |
|
136 | + $this->_prefix=$value; |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | */ |
143 | 143 | protected function calculateKey($id) |
144 | 144 | { |
145 | - return $this->_prefix.':'.$id; |
|
145 | + return $this->_prefix.':'.$id; |
|
146 | 146 | } |
147 | 147 | } |
148 | 148 |
@@ -55,11 +55,11 @@ discard block |
||
55 | 55 | if($this->_cacheModuleID==='') |
56 | 56 | throw new TConfigurationException('cachesession_cachemoduleid_required'); |
57 | 57 | else if(($cache=$this->getApplication()->getModule($this->_cacheModuleID))===null) |
58 | - throw new TConfigurationException('cachesession_cachemodule_inexistent',$this->_cacheModuleID); |
|
58 | + throw new TConfigurationException('cachesession_cachemodule_inexistent', $this->_cacheModuleID); |
|
59 | 59 | else if($cache instanceof ICache) |
60 | 60 | $this->_cache=$cache; |
61 | 61 | else |
62 | - throw new TConfigurationException('cachesession_cachemodule_invalid',$this->_cacheModuleID); |
|
62 | + throw new TConfigurationException('cachesession_cachemodule_invalid', $this->_cacheModuleID); |
|
63 | 63 | $this->setUseCustomStorage(true); |
64 | 64 | parent::init($config); |
65 | 65 | } |
@@ -104,9 +104,9 @@ discard block |
||
104 | 104 | * @param string session data |
105 | 105 | * @return boolean whether session write is successful |
106 | 106 | */ |
107 | - public function _write($id,$data) |
|
107 | + public function _write($id, $data) |
|
108 | 108 | { |
109 | - return $this->_cache->set($this->calculateKey($id),$data,$this->getTimeout()); |
|
109 | + return $this->_cache->set($this->calculateKey($id), $data, $this->getTimeout()); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -1026,28 +1026,28 @@ |
||
1026 | 1026 | return isset(self::$_relations[get_class($this)][strtolower($property)]); |
1027 | 1027 | } |
1028 | 1028 | |
1029 | - /** |
|
1030 | - * Return record data as array |
|
1031 | - * @return array of column name and column values |
|
1032 | - * @since 3.2.4 |
|
1033 | - */ |
|
1034 | - public function toArray(){ |
|
1035 | - $result=array(); |
|
1036 | - foreach($this->getRecordTableInfo()->getLowerCaseColumnNames() as $columnName){ |
|
1037 | - $result[$columnName]=$this->getColumnValue($columnName); |
|
1038 | - } |
|
1029 | + /** |
|
1030 | + * Return record data as array |
|
1031 | + * @return array of column name and column values |
|
1032 | + * @since 3.2.4 |
|
1033 | + */ |
|
1034 | + public function toArray(){ |
|
1035 | + $result=array(); |
|
1036 | + foreach($this->getRecordTableInfo()->getLowerCaseColumnNames() as $columnName){ |
|
1037 | + $result[$columnName]=$this->getColumnValue($columnName); |
|
1038 | + } |
|
1039 | 1039 | |
1040 | - return $result; |
|
1041 | - } |
|
1040 | + return $result; |
|
1041 | + } |
|
1042 | 1042 | |
1043 | - /** |
|
1044 | - * Return record data as JSON |
|
1045 | - * @return JSON |
|
1046 | - * @since 3.2.4 |
|
1047 | - */ |
|
1048 | - public function toJSON(){ |
|
1049 | - return json_encode($this->toArray()); |
|
1050 | - } |
|
1043 | + /** |
|
1044 | + * Return record data as JSON |
|
1045 | + * @return JSON |
|
1046 | + * @since 3.2.4 |
|
1047 | + */ |
|
1048 | + public function toJSON(){ |
|
1049 | + return json_encode($this->toArray()); |
|
1050 | + } |
|
1051 | 1051 | } |
1052 | 1052 | |
1053 | 1053 | /** |
@@ -505,6 +505,7 @@ discard block |
||
505 | 505 | * Delete multiple records using a criteria. |
506 | 506 | * @param string|TActiveRecordCriteria SQL condition or criteria object. |
507 | 507 | * @param mixed parameter values. |
508 | + * @param TActiveRecordCriteria $criteria |
|
508 | 509 | * @return int number of records deleted. |
509 | 510 | */ |
510 | 511 | public function deleteAll($criteria=null, $parameters=array()) |
@@ -571,6 +572,7 @@ discard block |
||
571 | 572 | * |
572 | 573 | * @param string|TActiveRecordCriteria SQL condition or criteria object. |
573 | 574 | * @param mixed parameter values. |
575 | + * @param TActiveRecordCriteria $criteria |
|
574 | 576 | * @return TActiveRecord matching record object. Null if no result is found. |
575 | 577 | */ |
576 | 578 | public function find($criteria,$parameters=array()) |
@@ -587,6 +589,7 @@ discard block |
||
587 | 589 | * |
588 | 590 | * @param string|TActiveRecordCriteria SQL condition or criteria object. |
589 | 591 | * @param mixed parameter values. |
592 | + * @param TActiveRecordCriteria $criteria |
|
590 | 593 | * @return array matching record objects. Empty array if no result is found. |
591 | 594 | */ |
592 | 595 | public function findAll($criteria=null,$parameters=array()) |
@@ -700,6 +703,7 @@ discard block |
||
700 | 703 | * Find the number of records. |
701 | 704 | * @param string|TActiveRecordCriteria SQL condition or criteria object. |
702 | 705 | * @param mixed parameter values. |
706 | + * @param TActiveRecordCriteria $criteria |
|
703 | 707 | * @return int number of records. |
704 | 708 | */ |
705 | 709 | public function count($criteria=null,$parameters=array()) |
@@ -715,6 +719,7 @@ discard block |
||
715 | 719 | * value equal to the $property value. |
716 | 720 | * @param string relationship/property name corresponding to keys in $RELATION array. |
717 | 721 | * @param array method call arguments. |
722 | + * @param string $name |
|
718 | 723 | * @return TActiveRecordRelation, null if the context or the handler doesn't exist |
719 | 724 | */ |
720 | 725 | protected function getRelationHandler($name,$args=array()) |
@@ -939,6 +944,7 @@ discard block |
||
939 | 944 | * Raised before the record attempt to insert its data into the database. |
940 | 945 | * To prevent the insert operation, set the TActiveRecordChangeEventParameter::IsValid parameter to false. |
941 | 946 | * @param TActiveRecordChangeEventParameter event parameter to be passed to the event handlers |
947 | + * @param TActiveRecordChangeEventParameter $param |
|
942 | 948 | */ |
943 | 949 | public function onInsert($param) |
944 | 950 | { |
@@ -949,6 +955,7 @@ discard block |
||
949 | 955 | * Raised before the record attempt to delete its data from the database. |
950 | 956 | * To prevent the delete operation, set the TActiveRecordChangeEventParameter::IsValid parameter to false. |
951 | 957 | * @param TActiveRecordChangeEventParameter event parameter to be passed to the event handlers |
958 | + * @param TActiveRecordChangeEventParameter $param |
|
952 | 959 | */ |
953 | 960 | public function onDelete($param) |
954 | 961 | { |
@@ -959,6 +966,7 @@ discard block |
||
959 | 966 | * Raised before the record attempt to update its data in the database. |
960 | 967 | * To prevent the update operation, set the TActiveRecordChangeEventParameter::IsValid parameter to false. |
961 | 968 | * @param TActiveRecordChangeEventParameter event parameter to be passed to the event handlers |
969 | + * @param TActiveRecordChangeEventParameter $param |
|
962 | 970 | */ |
963 | 971 | public function onUpdate($param) |
964 | 972 | { |
@@ -1042,7 +1050,7 @@ discard block |
||
1042 | 1050 | |
1043 | 1051 | /** |
1044 | 1052 | * Return record data as JSON |
1045 | - * @return JSON |
|
1053 | + * @return string |
|
1046 | 1054 | * @since 3.2.4 |
1047 | 1055 | */ |
1048 | 1056 | public function toJSON(){ |
@@ -194,14 +194,14 @@ discard block |
||
194 | 194 | * @var TActiveRecordInvalidFinderResult |
195 | 195 | * @since 3.1.5 |
196 | 196 | */ |
197 | - protected $_invalidFinderResult = null; // use protected so that serialization is fine |
|
197 | + protected $_invalidFinderResult=null; // use protected so that serialization is fine |
|
198 | 198 | |
199 | 199 | /** |
200 | 200 | * Prevent __call() method creating __sleep() when serializing. |
201 | 201 | */ |
202 | 202 | public function __sleep() |
203 | 203 | { |
204 | - return array_diff(parent::__sleep(),array("\0*\0_connection")); |
|
204 | + return array_diff(parent::__sleep(), array("\0*\0_connection")); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
@@ -256,12 +256,12 @@ discard block |
||
256 | 256 | * @param mixed property value. |
257 | 257 | * @since 3.1.2 |
258 | 258 | */ |
259 | - public function __set($name,$value) |
|
259 | + public function __set($name, $value) |
|
260 | 260 | { |
261 | 261 | if($this->hasRecordRelation($name) && !$this->canSetProperty($name)) |
262 | 262 | $this->$name=$value; |
263 | 263 | else |
264 | - parent::__set($name,$value); |
|
264 | + parent::__set($name, $value); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | /** |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $class=new ReflectionClass($className); |
289 | 289 | $relations=array(); |
290 | 290 | foreach($class->getStaticPropertyValue('RELATIONS') as $key=>$value) |
291 | - $relations[strtolower($key)]=array($key,$value); |
|
291 | + $relations[strtolower($key)]=array($key, $value); |
|
292 | 292 | self::$_relations[$className]=$relations; |
293 | 293 | } |
294 | 294 | } |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | if(!is_array($data)) |
305 | 305 | throw new TActiveRecordException('ar_data_invalid', get_class($this)); |
306 | 306 | foreach($data as $name=>$value) |
307 | - $this->setColumnValue($name,$value); |
|
307 | + $this->setColumnValue($name, $value); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | |
@@ -355,16 +355,16 @@ discard block |
||
355 | 355 | { |
356 | 356 | if($record===null || get_class($this)!==get_class($record)) |
357 | 357 | return false; |
358 | - $tableInfo = $this->getRecordTableInfo(); |
|
359 | - $pks = $tableInfo->getPrimaryKeys(); |
|
360 | - $properties = count($pks) > 0 ? $pks : $tableInfo->getColumns()->getKeys(); |
|
358 | + $tableInfo=$this->getRecordTableInfo(); |
|
359 | + $pks=$tableInfo->getPrimaryKeys(); |
|
360 | + $properties=count($pks) > 0 ? $pks : $tableInfo->getColumns()->getKeys(); |
|
361 | 361 | $equals=true; |
362 | 362 | foreach($properties as $prop) |
363 | 363 | { |
364 | 364 | if($strict) |
365 | - $equals = $equals && $this->getColumnValue($prop) === $record->getColumnValue($prop); |
|
365 | + $equals=$equals && $this->getColumnValue($prop)===$record->getColumnValue($prop); |
|
366 | 366 | else |
367 | - $equals = $equals && $this->getColumnValue($prop) == $record->getColumnValue($prop); |
|
367 | + $equals=$equals && $this->getColumnValue($prop)==$record->getColumnValue($prop); |
|
368 | 368 | if(!$equals) |
369 | 369 | return false; |
370 | 370 | } |
@@ -382,10 +382,10 @@ discard block |
||
382 | 382 | */ |
383 | 383 | public static function finder($className=__CLASS__) |
384 | 384 | { |
385 | - static $finders = array(); |
|
385 | + static $finders=array(); |
|
386 | 386 | if(!isset($finders[$className])) |
387 | 387 | { |
388 | - $f = Prado::createComponent($className); |
|
388 | + $f=Prado::createComponent($className); |
|
389 | 389 | $finders[$className]=$f; |
390 | 390 | } |
391 | 391 | return $finders[$className]; |
@@ -415,14 +415,14 @@ discard block |
||
415 | 415 | */ |
416 | 416 | public function save() |
417 | 417 | { |
418 | - $gateway = $this->getRecordGateway(); |
|
419 | - $param = new TActiveRecordChangeEventParameter(); |
|
418 | + $gateway=$this->getRecordGateway(); |
|
419 | + $param=new TActiveRecordChangeEventParameter(); |
|
420 | 420 | if($this->_recordState===self::STATE_NEW) |
421 | 421 | { |
422 | 422 | $this->onInsert($param); |
423 | 423 | if($param->getIsValid() && $gateway->insert($this)) |
424 | 424 | { |
425 | - $this->_recordState = self::STATE_LOADED; |
|
425 | + $this->_recordState=self::STATE_LOADED; |
|
426 | 426 | return true; |
427 | 427 | } |
428 | 428 | } |
@@ -447,8 +447,8 @@ discard block |
||
447 | 447 | { |
448 | 448 | if($this->_recordState===self::STATE_LOADED) |
449 | 449 | { |
450 | - $gateway = $this->getRecordGateway(); |
|
451 | - $param = new TActiveRecordChangeEventParameter(); |
|
450 | + $gateway=$this->getRecordGateway(); |
|
451 | + $param=new TActiveRecordChangeEventParameter(); |
|
452 | 452 | $this->onDelete($param); |
453 | 453 | if($param->getIsValid() && $gateway->delete($this)) |
454 | 454 | { |
@@ -488,8 +488,8 @@ discard block |
||
488 | 488 | public function deleteByPk($keys) |
489 | 489 | { |
490 | 490 | if(func_num_args() > 1) |
491 | - $keys = func_get_args(); |
|
492 | - return $this->getRecordGateway()->deleteRecordsByPk($this,(array)$keys); |
|
491 | + $keys=func_get_args(); |
|
492 | + return $this->getRecordGateway()->deleteRecordsByPk($this, (array) $keys); |
|
493 | 493 | } |
494 | 494 | |
495 | 495 | /** |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | public function deleteAllByPks($keys) |
499 | 499 | { |
500 | 500 | if(func_num_args() > 1) |
501 | - $keys = func_get_args(); |
|
501 | + $keys=func_get_args(); |
|
502 | 502 | return $this->deleteByPk($keys); |
503 | 503 | } |
504 | 504 | /** |
@@ -509,8 +509,8 @@ discard block |
||
509 | 509 | */ |
510 | 510 | public function deleteAll($criteria=null, $parameters=array()) |
511 | 511 | { |
512 | - $args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null; |
|
513 | - $criteria = $this->getRecordCriteria($criteria,$parameters, $args); |
|
512 | + $args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null; |
|
513 | + $criteria=$this->getRecordCriteria($criteria, $parameters, $args); |
|
514 | 514 | return $this->getRecordGateway()->deleteRecordsByCriteria($this, $criteria); |
515 | 515 | } |
516 | 516 | |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | { |
535 | 535 | $result=array(); |
536 | 536 | foreach($reader as $data) |
537 | - $result[] = $this->populateObject($data); |
|
537 | + $result[]=$this->populateObject($data); |
|
538 | 538 | return $result; |
539 | 539 | } |
540 | 540 | |
@@ -573,12 +573,12 @@ discard block |
||
573 | 573 | * @param mixed parameter values. |
574 | 574 | * @return TActiveRecord matching record object. Null if no result is found. |
575 | 575 | */ |
576 | - public function find($criteria,$parameters=array()) |
|
576 | + public function find($criteria, $parameters=array()) |
|
577 | 577 | { |
578 | - $args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null; |
|
579 | - $criteria = $this->getRecordCriteria($criteria,$parameters, $args); |
|
578 | + $args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null; |
|
579 | + $criteria=$this->getRecordCriteria($criteria, $parameters, $args); |
|
580 | 580 | $criteria->setLimit(1); |
581 | - $data = $this->getRecordGateway()->findRecordsByCriteria($this,$criteria); |
|
581 | + $data=$this->getRecordGateway()->findRecordsByCriteria($this, $criteria); |
|
582 | 582 | return $this->populateObject($data); |
583 | 583 | } |
584 | 584 | |
@@ -589,12 +589,12 @@ discard block |
||
589 | 589 | * @param mixed parameter values. |
590 | 590 | * @return array matching record objects. Empty array if no result is found. |
591 | 591 | */ |
592 | - public function findAll($criteria=null,$parameters=array()) |
|
592 | + public function findAll($criteria=null, $parameters=array()) |
|
593 | 593 | { |
594 | - $args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null; |
|
594 | + $args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null; |
|
595 | 595 | if($criteria!==null) |
596 | - $criteria = $this->getRecordCriteria($criteria,$parameters, $args); |
|
597 | - $result = $this->getRecordGateway()->findRecordsByCriteria($this,$criteria,true); |
|
596 | + $criteria=$this->getRecordCriteria($criteria, $parameters, $args); |
|
597 | + $result=$this->getRecordGateway()->findRecordsByCriteria($this, $criteria, true); |
|
598 | 598 | return $this->populateObjects($result); |
599 | 599 | } |
600 | 600 | |
@@ -612,11 +612,11 @@ discard block |
||
612 | 612 | */ |
613 | 613 | public function findByPk($keys) |
614 | 614 | { |
615 | - if($keys === null) |
|
615 | + if($keys===null) |
|
616 | 616 | return null; |
617 | 617 | if(func_num_args() > 1) |
618 | - $keys = func_get_args(); |
|
619 | - $data = $this->getRecordGateway()->findRecordByPK($this,$keys); |
|
618 | + $keys=func_get_args(); |
|
619 | + $data=$this->getRecordGateway()->findRecordByPK($this, $keys); |
|
620 | 620 | return $this->populateObject($data); |
621 | 621 | } |
622 | 622 | |
@@ -640,8 +640,8 @@ discard block |
||
640 | 640 | public function findAllByPks($keys) |
641 | 641 | { |
642 | 642 | if(func_num_args() > 1) |
643 | - $keys = func_get_args(); |
|
644 | - $result = $this->getRecordGateway()->findRecordsByPks($this,(array)$keys); |
|
643 | + $keys=func_get_args(); |
|
644 | + $result=$this->getRecordGateway()->findRecordsByPks($this, (array) $keys); |
|
645 | 645 | return $this->populateObjects($result); |
646 | 646 | } |
647 | 647 | |
@@ -653,12 +653,12 @@ discard block |
||
653 | 653 | * @param array $parameters |
654 | 654 | * @return TActiveRecord, null if no result is returned. |
655 | 655 | */ |
656 | - public function findBySql($sql,$parameters=array()) |
|
656 | + public function findBySql($sql, $parameters=array()) |
|
657 | 657 | { |
658 | - $args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null; |
|
659 | - $criteria = $this->getRecordCriteria($sql,$parameters, $args); |
|
658 | + $args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null; |
|
659 | + $criteria=$this->getRecordCriteria($sql, $parameters, $args); |
|
660 | 660 | $criteria->setLimit(1); |
661 | - $data = $this->getRecordGateway()->findRecordBySql($this,$criteria); |
|
661 | + $data=$this->getRecordGateway()->findRecordBySql($this, $criteria); |
|
662 | 662 | return $this->populateObject($data); |
663 | 663 | } |
664 | 664 | |
@@ -670,11 +670,11 @@ discard block |
||
670 | 670 | * @param array $parameters |
671 | 671 | * @return array matching active records. Empty array is returned if no result is found. |
672 | 672 | */ |
673 | - public function findAllBySql($sql,$parameters=array()) |
|
673 | + public function findAllBySql($sql, $parameters=array()) |
|
674 | 674 | { |
675 | - $args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null; |
|
676 | - $criteria = $this->getRecordCriteria($sql,$parameters, $args); |
|
677 | - $result = $this->getRecordGateway()->findRecordsBySql($this,$criteria); |
|
675 | + $args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null; |
|
676 | + $criteria=$this->getRecordCriteria($sql, $parameters, $args); |
|
677 | + $result=$this->getRecordGateway()->findRecordsBySql($this, $criteria); |
|
678 | 678 | return $this->populateObjects($result); |
679 | 679 | } |
680 | 680 | |
@@ -690,9 +690,9 @@ discard block |
||
690 | 690 | * @param array matching field values. |
691 | 691 | * @return array matching active records. Empty array is returned if no result is found. |
692 | 692 | */ |
693 | - public function findAllByIndex($criteria,$fields,$values) |
|
693 | + public function findAllByIndex($criteria, $fields, $values) |
|
694 | 694 | { |
695 | - $result = $this->getRecordGateway()->findRecordsByIndex($this,$criteria,$fields,$values); |
|
695 | + $result=$this->getRecordGateway()->findRecordsByIndex($this, $criteria, $fields, $values); |
|
696 | 696 | return $this->populateObjects($result); |
697 | 697 | } |
698 | 698 | |
@@ -702,12 +702,12 @@ discard block |
||
702 | 702 | * @param mixed parameter values. |
703 | 703 | * @return int number of records. |
704 | 704 | */ |
705 | - public function count($criteria=null,$parameters=array()) |
|
705 | + public function count($criteria=null, $parameters=array()) |
|
706 | 706 | { |
707 | - $args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null; |
|
707 | + $args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null; |
|
708 | 708 | if($criteria!==null) |
709 | - $criteria = $this->getRecordCriteria($criteria,$parameters, $args); |
|
710 | - return $this->getRecordGateway()->countRecords($this,$criteria); |
|
709 | + $criteria=$this->getRecordCriteria($criteria, $parameters, $args); |
|
710 | + return $this->getRecordGateway()->countRecords($this, $criteria); |
|
711 | 711 | } |
712 | 712 | |
713 | 713 | /** |
@@ -717,11 +717,11 @@ discard block |
||
717 | 717 | * @param array method call arguments. |
718 | 718 | * @return TActiveRecordRelation, null if the context or the handler doesn't exist |
719 | 719 | */ |
720 | - protected function getRelationHandler($name,$args=array()) |
|
720 | + protected function getRelationHandler($name, $args=array()) |
|
721 | 721 | { |
722 | - if(($context=$this->createRelationContext($name)) !== null) |
|
722 | + if(($context=$this->createRelationContext($name))!==null) |
|
723 | 723 | { |
724 | - $criteria = $this->getRecordCriteria(count($args)>0 ? $args[0] : null, array_slice($args,1)); |
|
724 | + $criteria=$this->getRecordCriteria(count($args) > 0 ? $args[0] : null, array_slice($args, 1)); |
|
725 | 725 | return $context->getRelationHandler($criteria); |
726 | 726 | } |
727 | 727 | else |
@@ -741,8 +741,8 @@ discard block |
||
741 | 741 | { |
742 | 742 | if(($definition=$this->getRecordRelation($name))!==null) |
743 | 743 | { |
744 | - list($property, $relation) = $definition; |
|
745 | - return new TActiveRecordRelationContext($this,$property,$relation); |
|
744 | + list($property, $relation)=$definition; |
|
745 | + return new TActiveRecordRelationContext($this, $property, $relation); |
|
746 | 746 | } |
747 | 747 | else |
748 | 748 | return null; |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | */ |
786 | 786 | protected function fetchResultsFor($property) |
787 | 787 | { |
788 | - if( ($context=$this->createRelationContext($property)) !== null) |
|
788 | + if(($context=$this->createRelationContext($property))!==null) |
|
789 | 789 | return $context->getRelationHandler()->fetchResultsInto($this); |
790 | 790 | else |
791 | 791 | return false; |
@@ -820,31 +820,31 @@ discard block |
||
820 | 820 | * @return mixed single record if method name starts with "findBy", 0 or more records |
821 | 821 | * if method name starts with "findAllBy" |
822 | 822 | */ |
823 | - public function __call($method,$args) |
|
823 | + public function __call($method, $args) |
|
824 | 824 | { |
825 | - $delete =false; |
|
826 | - if(strncasecmp($method,'with',4)===0) |
|
825 | + $delete=false; |
|
826 | + if(strncasecmp($method, 'with', 4)===0) |
|
827 | 827 | { |
828 | - $property= $method[4]==='_' ? substr($method,5) : substr($method,4); |
|
828 | + $property=$method[4]==='_' ? substr($method, 5) : substr($method, 4); |
|
829 | 829 | return $this->getRelationHandler($property, $args); |
830 | 830 | } |
831 | - else if($findOne=strncasecmp($method,'findby',6)===0) |
|
832 | - $condition = $method[6]==='_' ? substr($method,7) : substr($method,6); |
|
833 | - else if(strncasecmp($method,'findallby',9)===0) |
|
834 | - $condition = $method[9]==='_' ? substr($method,10) : substr($method,9); |
|
835 | - else if($delete=strncasecmp($method,'deleteby',8)===0) |
|
836 | - $condition = $method[8]==='_' ? substr($method,9) : substr($method,8); |
|
837 | - else if($delete=strncasecmp($method,'deleteallby',11)===0) |
|
838 | - $condition = $method[11]==='_' ? substr($method,12) : substr($method,11); |
|
831 | + else if($findOne=strncasecmp($method, 'findby', 6)===0) |
|
832 | + $condition=$method[6]==='_' ? substr($method, 7) : substr($method, 6); |
|
833 | + else if(strncasecmp($method, 'findallby', 9)===0) |
|
834 | + $condition=$method[9]==='_' ? substr($method, 10) : substr($method, 9); |
|
835 | + else if($delete=strncasecmp($method, 'deleteby', 8)===0) |
|
836 | + $condition=$method[8]==='_' ? substr($method, 9) : substr($method, 8); |
|
837 | + else if($delete=strncasecmp($method, 'deleteallby', 11)===0) |
|
838 | + $condition=$method[11]==='_' ? substr($method, 12) : substr($method, 11); |
|
839 | 839 | else |
840 | 840 | { |
841 | - if($this->getInvalidFinderResult() == TActiveRecordInvalidFinderResult::Exception) |
|
842 | - throw new TActiveRecordException('ar_invalid_finder_method',$method); |
|
841 | + if($this->getInvalidFinderResult()==TActiveRecordInvalidFinderResult::Exception) |
|
842 | + throw new TActiveRecordException('ar_invalid_finder_method', $method); |
|
843 | 843 | else |
844 | 844 | return null; |
845 | 845 | } |
846 | 846 | |
847 | - $criteria = $this->getRecordGateway()->getCommand($this)->createCriteriaFromString($method, $condition, $args); |
|
847 | + $criteria=$this->getRecordGateway()->getCommand($this)->createCriteriaFromString($method, $condition, $args); |
|
848 | 848 | if($delete) |
849 | 849 | return $this->deleteAll($criteria); |
850 | 850 | else |
@@ -858,7 +858,7 @@ discard block |
||
858 | 858 | */ |
859 | 859 | public function getInvalidFinderResult() |
860 | 860 | { |
861 | - if($this->_invalidFinderResult !== null) |
|
861 | + if($this->_invalidFinderResult!==null) |
|
862 | 862 | return $this->_invalidFinderResult; |
863 | 863 | |
864 | 864 | return self::getRecordManager()->getInvalidFinderResult(); |
@@ -873,10 +873,10 @@ discard block |
||
873 | 873 | */ |
874 | 874 | public function setInvalidFinderResult($value) |
875 | 875 | { |
876 | - if($value === null) |
|
877 | - $this->_invalidFinderResult = null; |
|
876 | + if($value===null) |
|
877 | + $this->_invalidFinderResult=null; |
|
878 | 878 | else |
879 | - $this->_invalidFinderResult = TPropertyValue::ensureEnum($value, 'TActiveRecordInvalidFinderResult'); |
|
879 | + $this->_invalidFinderResult=TPropertyValue::ensureEnum($value, 'TActiveRecordInvalidFinderResult'); |
|
880 | 880 | } |
881 | 881 | |
882 | 882 | /** |
@@ -892,8 +892,8 @@ discard block |
||
892 | 892 | { |
893 | 893 | if(is_string($criteria)) |
894 | 894 | { |
895 | - $useArgs = !is_array($parameters) && is_array($args); |
|
896 | - return new TActiveRecordCriteria($criteria,$useArgs ? $args : $parameters); |
|
895 | + $useArgs=!is_array($parameters) && is_array($args); |
|
896 | + return new TActiveRecordCriteria($criteria, $useArgs ? $args : $parameters); |
|
897 | 897 | } |
898 | 898 | else if($criteria instanceof TSqlCriteria) |
899 | 899 | return $criteria; |
@@ -987,7 +987,7 @@ discard block |
||
987 | 987 | * @param mixed the corresponding column value |
988 | 988 | * @since 3.1.1 |
989 | 989 | */ |
990 | - public function setColumnValue($columnName,$value) |
|
990 | + public function setColumnValue($columnName, $value) |
|
991 | 991 | { |
992 | 992 | $className=get_class($this); |
993 | 993 | if(isset(self::$_columnMapping[$className][$columnName])) |
@@ -1004,7 +1004,7 @@ discard block |
||
1004 | 1004 | { |
1005 | 1005 | $className=get_class($this); |
1006 | 1006 | $property=strtolower($property); |
1007 | - return isset(self::$_relations[$className][$property])?self::$_relations[$className][$property]:null; |
|
1007 | + return isset(self::$_relations[$className][$property]) ? self::$_relations[$className][$property] : null; |
|
1008 | 1008 | } |
1009 | 1009 | |
1010 | 1010 | /** |
@@ -1031,9 +1031,9 @@ discard block |
||
1031 | 1031 | * @return array of column name and column values |
1032 | 1032 | * @since 3.2.4 |
1033 | 1033 | */ |
1034 | - public function toArray(){ |
|
1034 | + public function toArray() { |
|
1035 | 1035 | $result=array(); |
1036 | - foreach($this->getRecordTableInfo()->getLowerCaseColumnNames() as $columnName){ |
|
1036 | + foreach($this->getRecordTableInfo()->getLowerCaseColumnNames() as $columnName) { |
|
1037 | 1037 | $result[$columnName]=$this->getColumnValue($columnName); |
1038 | 1038 | } |
1039 | 1039 | |
@@ -1045,7 +1045,7 @@ discard block |
||
1045 | 1045 | * @return JSON |
1046 | 1046 | * @since 3.2.4 |
1047 | 1047 | */ |
1048 | - public function toJSON(){ |
|
1048 | + public function toJSON() { |
|
1049 | 1049 | return json_encode($this->toArray()); |
1050 | 1050 | } |
1051 | 1051 | } |
@@ -1080,7 +1080,7 @@ discard block |
||
1080 | 1080 | */ |
1081 | 1081 | public function setIsValid($value) |
1082 | 1082 | { |
1083 | - $this->_isValid = TPropertyValue::ensureBoolean($value); |
|
1083 | + $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
1084 | 1084 | } |
1085 | 1085 | } |
1086 | 1086 | |
@@ -1102,6 +1102,6 @@ discard block |
||
1102 | 1102 | */ |
1103 | 1103 | class TActiveRecordInvalidFinderResult extends TEnumerable |
1104 | 1104 | { |
1105 | - const Null = 'Null'; |
|
1106 | - const Exception = 'Exception'; |
|
1105 | + const Null='Null'; |
|
1106 | + const Exception='Exception'; |
|
1107 | 1107 | } |
@@ -425,14 +425,12 @@ discard block |
||
425 | 425 | $this->_recordState = self::STATE_LOADED; |
426 | 426 | return true; |
427 | 427 | } |
428 | - } |
|
429 | - else if($this->_recordState===self::STATE_LOADED) |
|
428 | + } else if($this->_recordState===self::STATE_LOADED) |
|
430 | 429 | { |
431 | 430 | $this->onUpdate($param); |
432 | 431 | if($param->getIsValid() && $gateway->update($this)) |
433 | 432 | return true; |
434 | - } |
|
435 | - else |
|
433 | + } else |
|
436 | 434 | throw new TActiveRecordException('ar_save_invalid', get_class($this)); |
437 | 435 | |
438 | 436 | return false; |
@@ -455,8 +453,7 @@ discard block |
||
455 | 453 | $this->_recordState=self::STATE_DELETED; |
456 | 454 | return true; |
457 | 455 | } |
458 | - } |
|
459 | - else |
|
456 | + } else |
|
460 | 457 | throw new TActiveRecordException('ar_delete_invalid', get_class($this)); |
461 | 458 | |
462 | 459 | return false; |
@@ -723,8 +720,7 @@ discard block |
||
723 | 720 | { |
724 | 721 | $criteria = $this->getRecordCriteria(count($args)>0 ? $args[0] : null, array_slice($args,1)); |
725 | 722 | return $context->getRelationHandler($criteria); |
726 | - } |
|
727 | - else |
|
723 | + } else |
|
728 | 724 | return null; |
729 | 725 | } |
730 | 726 | |
@@ -743,8 +739,7 @@ discard block |
||
743 | 739 | { |
744 | 740 | list($property, $relation) = $definition; |
745 | 741 | return new TActiveRecordRelationContext($this,$property,$relation); |
746 | - } |
|
747 | - else |
|
742 | + } else |
|
748 | 743 | return null; |
749 | 744 | } |
750 | 745 | |
@@ -827,8 +822,7 @@ discard block |
||
827 | 822 | { |
828 | 823 | $property= $method[4]==='_' ? substr($method,5) : substr($method,4); |
829 | 824 | return $this->getRelationHandler($property, $args); |
830 | - } |
|
831 | - else if($findOne=strncasecmp($method,'findby',6)===0) |
|
825 | + } else if($findOne=strncasecmp($method,'findby',6)===0) |
|
832 | 826 | $condition = $method[6]==='_' ? substr($method,7) : substr($method,6); |
833 | 827 | else if(strncasecmp($method,'findallby',9)===0) |
834 | 828 | $condition = $method[9]==='_' ? substr($method,10) : substr($method,9); |
@@ -894,8 +888,7 @@ discard block |
||
894 | 888 | { |
895 | 889 | $useArgs = !is_array($parameters) && is_array($args); |
896 | 890 | return new TActiveRecordCriteria($criteria,$useArgs ? $args : $parameters); |
897 | - } |
|
898 | - else if($criteria instanceof TSqlCriteria) |
|
891 | + } else if($criteria instanceof TSqlCriteria) |
|
899 | 892 | return $criteria; |
900 | 893 | else |
901 | 894 | return new TActiveRecordCriteria(); |
@@ -36,46 +36,46 @@ |
||
36 | 36 | class TWsatService extends TPageService |
37 | 37 | { |
38 | 38 | |
39 | - private $_pass = ''; |
|
39 | + private $_pass = ''; |
|
40 | 40 | |
41 | - public function init($config) |
|
42 | - { |
|
43 | - if ($this->getApplication()->getMode() === TApplicationMode::Performance || $this->getApplication()->getMode() === TApplicationMode::Normal) |
|
44 | - throw new TInvalidOperationException("You should not use Prado WSAT in any of the production modes."); |
|
41 | + public function init($config) |
|
42 | + { |
|
43 | + if ($this->getApplication()->getMode() === TApplicationMode::Performance || $this->getApplication()->getMode() === TApplicationMode::Normal) |
|
44 | + throw new TInvalidOperationException("You should not use Prado WSAT in any of the production modes."); |
|
45 | 45 | |
46 | - if (empty($this->_pass)) |
|
47 | - throw new TConfigurationException("You need to specify the Password attribute."); |
|
46 | + if (empty($this->_pass)) |
|
47 | + throw new TConfigurationException("You need to specify the Password attribute."); |
|
48 | 48 | |
49 | - $this->setDefaultPage("TWsatHome"); |
|
50 | - $this->_startThemeManager(); |
|
51 | - parent::init($config); |
|
52 | - } |
|
49 | + $this->setDefaultPage("TWsatHome"); |
|
50 | + $this->_startThemeManager(); |
|
51 | + parent::init($config); |
|
52 | + } |
|
53 | 53 | |
54 | - public function getBasePath() |
|
55 | - { |
|
56 | - $basePath = Prado::getPathOfNamespace("System.Wsat.pages"); |
|
57 | - return realpath($basePath); |
|
58 | - } |
|
54 | + public function getBasePath() |
|
55 | + { |
|
56 | + $basePath = Prado::getPathOfNamespace("System.Wsat.pages"); |
|
57 | + return realpath($basePath); |
|
58 | + } |
|
59 | 59 | |
60 | - private function _startThemeManager() |
|
61 | - { |
|
62 | - $themeManager = new TThemeManager; |
|
63 | - $themeManager->BasePath = "System.Wsat.themes"; |
|
64 | - $url = Prado::getApplication()->getAssetManager()->publishFilePath(Prado::getPathOfNamespace('System.Wsat')); |
|
65 | - $themeManager->BaseUrl = "$url/themes"; |
|
60 | + private function _startThemeManager() |
|
61 | + { |
|
62 | + $themeManager = new TThemeManager; |
|
63 | + $themeManager->BasePath = "System.Wsat.themes"; |
|
64 | + $url = Prado::getApplication()->getAssetManager()->publishFilePath(Prado::getPathOfNamespace('System.Wsat')); |
|
65 | + $themeManager->BaseUrl = "$url/themes"; |
|
66 | 66 | |
67 | - $themeManager->init(null); |
|
68 | - $this->setThemeManager($themeManager); |
|
69 | - } |
|
67 | + $themeManager->init(null); |
|
68 | + $this->setThemeManager($themeManager); |
|
69 | + } |
|
70 | 70 | |
71 | - public function getPassword() |
|
72 | - { |
|
73 | - return $this->_pass; |
|
74 | - } |
|
71 | + public function getPassword() |
|
72 | + { |
|
73 | + return $this->_pass; |
|
74 | + } |
|
75 | 75 | |
76 | - public function setPassword($_pass) |
|
77 | - { |
|
78 | - $this->_pass = $_pass; |
|
79 | - } |
|
76 | + public function setPassword($_pass) |
|
77 | + { |
|
78 | + $this->_pass = $_pass; |
|
79 | + } |
|
80 | 80 | |
81 | 81 | } |
82 | 82 | \ No newline at end of file |
@@ -36,14 +36,14 @@ discard block |
||
36 | 36 | class TWsatService extends TPageService |
37 | 37 | { |
38 | 38 | |
39 | - private $_pass = ''; |
|
39 | + private $_pass=''; |
|
40 | 40 | |
41 | 41 | public function init($config) |
42 | 42 | { |
43 | - if ($this->getApplication()->getMode() === TApplicationMode::Performance || $this->getApplication()->getMode() === TApplicationMode::Normal) |
|
43 | + if($this->getApplication()->getMode()===TApplicationMode::Performance || $this->getApplication()->getMode()===TApplicationMode::Normal) |
|
44 | 44 | throw new TInvalidOperationException("You should not use Prado WSAT in any of the production modes."); |
45 | 45 | |
46 | - if (empty($this->_pass)) |
|
46 | + if(empty($this->_pass)) |
|
47 | 47 | throw new TConfigurationException("You need to specify the Password attribute."); |
48 | 48 | |
49 | 49 | $this->setDefaultPage("TWsatHome"); |
@@ -53,16 +53,16 @@ discard block |
||
53 | 53 | |
54 | 54 | public function getBasePath() |
55 | 55 | { |
56 | - $basePath = Prado::getPathOfNamespace("System.Wsat.pages"); |
|
56 | + $basePath=Prado::getPathOfNamespace("System.Wsat.pages"); |
|
57 | 57 | return realpath($basePath); |
58 | 58 | } |
59 | 59 | |
60 | 60 | private function _startThemeManager() |
61 | 61 | { |
62 | - $themeManager = new TThemeManager; |
|
63 | - $themeManager->BasePath = "System.Wsat.themes"; |
|
64 | - $url = Prado::getApplication()->getAssetManager()->publishFilePath(Prado::getPathOfNamespace('System.Wsat')); |
|
65 | - $themeManager->BaseUrl = "$url/themes"; |
|
62 | + $themeManager=new TThemeManager; |
|
63 | + $themeManager->BasePath="System.Wsat.themes"; |
|
64 | + $url=Prado::getApplication()->getAssetManager()->publishFilePath(Prado::getPathOfNamespace('System.Wsat')); |
|
65 | + $themeManager->BaseUrl="$url/themes"; |
|
66 | 66 | |
67 | 67 | $themeManager->init(null); |
68 | 68 | $this->setThemeManager($themeManager); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | public function setPassword($_pass) |
77 | 77 | { |
78 | - $this->_pass = $_pass; |
|
78 | + $this->_pass=$_pass; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | } |
82 | 82 | \ No newline at end of file |
@@ -14,69 +14,69 @@ |
||
14 | 14 | class TWsatBaseGenerator |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * @return TDbMetaData for retrieving metadata information, such as |
|
19 | - * table and columns information, from a database connection. |
|
20 | - */ |
|
21 | - protected $_dbMetaData; |
|
17 | + /** |
|
18 | + * @return TDbMetaData for retrieving metadata information, such as |
|
19 | + * table and columns information, from a database connection. |
|
20 | + */ |
|
21 | + protected $_dbMetaData; |
|
22 | 22 | |
23 | - /** |
|
24 | - * Output folder where AR classes will be saved. |
|
25 | - */ |
|
26 | - protected $_opFile; |
|
23 | + /** |
|
24 | + * Output folder where AR classes will be saved. |
|
25 | + */ |
|
26 | + protected $_opFile; |
|
27 | 27 | |
28 | - function __construct() |
|
29 | - { |
|
30 | - if (!class_exists("TActiveRecordManager", false)) |
|
31 | - throw new Exception("You need to enable the ActiveRecord module in your application configuration file."); |
|
32 | - $ar_manager = TActiveRecordManager::getInstance(); |
|
33 | - $_conn = $ar_manager->getDbConnection(); |
|
34 | - $_conn->Active = true; |
|
35 | - $this->_dbMetaData = TDbMetaData::getInstance($_conn); |
|
36 | - } |
|
28 | + function __construct() |
|
29 | + { |
|
30 | + if (!class_exists("TActiveRecordManager", false)) |
|
31 | + throw new Exception("You need to enable the ActiveRecord module in your application configuration file."); |
|
32 | + $ar_manager = TActiveRecordManager::getInstance(); |
|
33 | + $_conn = $ar_manager->getDbConnection(); |
|
34 | + $_conn->Active = true; |
|
35 | + $this->_dbMetaData = TDbMetaData::getInstance($_conn); |
|
36 | + } |
|
37 | 37 | |
38 | - public function setOpFile($op_file_namespace) |
|
39 | - { |
|
40 | - $op_file = Prado::getPathOfNamespace($op_file_namespace); |
|
41 | - if (empty($op_file)) |
|
42 | - throw new Exception("You need to fix your output folder namespace."); |
|
43 | - if (!is_dir($op_file)) |
|
44 | - mkdir($op_file, 0777, true); |
|
45 | - $this->_opFile = $op_file; |
|
46 | - } |
|
38 | + public function setOpFile($op_file_namespace) |
|
39 | + { |
|
40 | + $op_file = Prado::getPathOfNamespace($op_file_namespace); |
|
41 | + if (empty($op_file)) |
|
42 | + throw new Exception("You need to fix your output folder namespace."); |
|
43 | + if (!is_dir($op_file)) |
|
44 | + mkdir($op_file, 0777, true); |
|
45 | + $this->_opFile = $op_file; |
|
46 | + } |
|
47 | 47 | |
48 | - public function renderAllTablesInformation() |
|
49 | - { |
|
50 | - foreach ($this->getAllTableNames() as $table_name) |
|
51 | - { |
|
52 | - echo $table_name . "<br>"; |
|
53 | - $tableInfo = $this->_dbMetaData->getTableInfo($table_name); |
|
54 | - echo "Table info:" . "<br>"; |
|
55 | - echo "<pre>"; |
|
56 | - print_r($tableInfo); |
|
57 | - echo "</pre>"; |
|
58 | - } |
|
59 | - } |
|
48 | + public function renderAllTablesInformation() |
|
49 | + { |
|
50 | + foreach ($this->getAllTableNames() as $table_name) |
|
51 | + { |
|
52 | + echo $table_name . "<br>"; |
|
53 | + $tableInfo = $this->_dbMetaData->getTableInfo($table_name); |
|
54 | + echo "Table info:" . "<br>"; |
|
55 | + echo "<pre>"; |
|
56 | + print_r($tableInfo); |
|
57 | + echo "</pre>"; |
|
58 | + } |
|
59 | + } |
|
60 | 60 | |
61 | - public function getAllTableNames() |
|
62 | - { |
|
63 | - $tableNames = $this->_dbMetaData->findTableNames(); |
|
64 | - $index = array_search('pradocache', $tableNames); |
|
65 | - if ($index) |
|
66 | - array_splice($tableNames, $index, 1); |
|
67 | - return $tableNames; |
|
68 | - } |
|
61 | + public function getAllTableNames() |
|
62 | + { |
|
63 | + $tableNames = $this->_dbMetaData->findTableNames(); |
|
64 | + $index = array_search('pradocache', $tableNames); |
|
65 | + if ($index) |
|
66 | + array_splice($tableNames, $index, 1); |
|
67 | + return $tableNames; |
|
68 | + } |
|
69 | 69 | |
70 | - public static function pr($data) |
|
71 | - { |
|
72 | - echo "<pre>"; |
|
73 | - print_r($data); |
|
74 | - echo "</pre>"; |
|
75 | - } |
|
70 | + public static function pr($data) |
|
71 | + { |
|
72 | + echo "<pre>"; |
|
73 | + print_r($data); |
|
74 | + echo "</pre>"; |
|
75 | + } |
|
76 | 76 | |
77 | - protected function eq($data) |
|
78 | - { |
|
79 | - return '"' . $data . '"'; |
|
80 | - } |
|
77 | + protected function eq($data) |
|
78 | + { |
|
79 | + return '"' . $data . '"'; |
|
80 | + } |
|
81 | 81 | |
82 | 82 | } |
@@ -27,31 +27,31 @@ discard block |
||
27 | 27 | |
28 | 28 | function __construct() |
29 | 29 | { |
30 | - if (!class_exists("TActiveRecordManager", false)) |
|
30 | + if(!class_exists("TActiveRecordManager", false)) |
|
31 | 31 | throw new Exception("You need to enable the ActiveRecord module in your application configuration file."); |
32 | - $ar_manager = TActiveRecordManager::getInstance(); |
|
33 | - $_conn = $ar_manager->getDbConnection(); |
|
34 | - $_conn->Active = true; |
|
35 | - $this->_dbMetaData = TDbMetaData::getInstance($_conn); |
|
32 | + $ar_manager=TActiveRecordManager::getInstance(); |
|
33 | + $_conn=$ar_manager->getDbConnection(); |
|
34 | + $_conn->Active=true; |
|
35 | + $this->_dbMetaData=TDbMetaData::getInstance($_conn); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | public function setOpFile($op_file_namespace) |
39 | 39 | { |
40 | - $op_file = Prado::getPathOfNamespace($op_file_namespace); |
|
41 | - if (empty($op_file)) |
|
40 | + $op_file=Prado::getPathOfNamespace($op_file_namespace); |
|
41 | + if(empty($op_file)) |
|
42 | 42 | throw new Exception("You need to fix your output folder namespace."); |
43 | - if (!is_dir($op_file)) |
|
43 | + if(!is_dir($op_file)) |
|
44 | 44 | mkdir($op_file, 0777, true); |
45 | - $this->_opFile = $op_file; |
|
45 | + $this->_opFile=$op_file; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | public function renderAllTablesInformation() |
49 | 49 | { |
50 | - foreach ($this->getAllTableNames() as $table_name) |
|
50 | + foreach($this->getAllTableNames() as $table_name) |
|
51 | 51 | { |
52 | - echo $table_name . "<br>"; |
|
53 | - $tableInfo = $this->_dbMetaData->getTableInfo($table_name); |
|
54 | - echo "Table info:" . "<br>"; |
|
52 | + echo $table_name."<br>"; |
|
53 | + $tableInfo=$this->_dbMetaData->getTableInfo($table_name); |
|
54 | + echo "Table info:"."<br>"; |
|
55 | 55 | echo "<pre>"; |
56 | 56 | print_r($tableInfo); |
57 | 57 | echo "</pre>"; |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | |
61 | 61 | public function getAllTableNames() |
62 | 62 | { |
63 | - $tableNames = $this->_dbMetaData->findTableNames(); |
|
64 | - $index = array_search('pradocache', $tableNames); |
|
65 | - if ($index) |
|
63 | + $tableNames=$this->_dbMetaData->findTableNames(); |
|
64 | + $index=array_search('pradocache', $tableNames); |
|
65 | + if($index) |
|
66 | 66 | array_splice($tableNames, $index, 1); |
67 | 67 | return $tableNames; |
68 | 68 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | protected function eq($data) |
78 | 78 | { |
79 | - return '"' . $data . '"'; |
|
79 | + return '"'.$data.'"'; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | } |