models.php 83 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736
  1. <?php
  2. /**
  3. * Mock models file
  4. *
  5. * Mock classes for use in Model and related test cases
  6. *
  7. * PHP 5
  8. *
  9. * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
  10. * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
  11. *
  12. * Licensed under The MIT License
  13. * Redistributions of files must retain the above copyright notice
  14. *
  15. * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
  16. * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
  17. * @package cake.tests.cases.libs.model
  18. * @since CakePHP(tm) v 1.2.0.6464
  19. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  20. */
  21. PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');
  22. /**
  23. * Test class
  24. *
  25. * @package cake.tests.cases.libs.model
  26. */
  27. class Test extends CakeTestModel {
  28. /**
  29. * useTable property
  30. *
  31. * @var bool false
  32. * @access public
  33. */
  34. public $useTable = false;
  35. /**
  36. * name property
  37. *
  38. * @var string 'Test'
  39. * @access public
  40. */
  41. public $name = 'Test';
  42. /**
  43. * schema property
  44. *
  45. * @var array
  46. * @access protected
  47. */
  48. protected $_schema = array(
  49. 'id'=> array('type' => 'integer', 'null' => '', 'default' => '1', 'length' => '8', 'key'=>'primary'),
  50. 'name'=> array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
  51. 'email'=> array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
  52. 'notes'=> array('type' => 'text', 'null' => '1', 'default' => 'write some notes here', 'length' => ''),
  53. 'created'=> array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
  54. 'updated'=> array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
  55. );
  56. }
  57. /**
  58. * TestAlias class
  59. *
  60. * @package cake.tests.cases.libs.model
  61. */
  62. class TestAlias extends CakeTestModel {
  63. /**
  64. * useTable property
  65. *
  66. * @var bool false
  67. * @access public
  68. */
  69. public $useTable = false;
  70. /**
  71. * name property
  72. *
  73. * @var string 'TestAlias'
  74. * @access public
  75. */
  76. public $name = 'TestAlias';
  77. /**
  78. * alias property
  79. *
  80. * @var string 'TestAlias'
  81. * @access public
  82. */
  83. public $alias = 'TestAlias';
  84. /**
  85. * schema property
  86. *
  87. * @var array
  88. * @access protected
  89. */
  90. protected $_schema = array(
  91. 'id'=> array('type' => 'integer', 'null' => '', 'default' => '1', 'length' => '8', 'key'=>'primary'),
  92. 'name'=> array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
  93. 'email'=> array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
  94. 'notes'=> array('type' => 'text', 'null' => '1', 'default' => 'write some notes here', 'length' => ''),
  95. 'created'=> array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
  96. 'updated'=> array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
  97. );
  98. }
  99. /**
  100. * TestValidate class
  101. *
  102. * @package cake.tests.cases.libs.model
  103. */
  104. class TestValidate extends CakeTestModel {
  105. /**
  106. * useTable property
  107. *
  108. * @var bool false
  109. * @access public
  110. */
  111. public $useTable = false;
  112. /**
  113. * name property
  114. *
  115. * @var string 'TestValidate'
  116. * @access public
  117. */
  118. public $name = 'TestValidate';
  119. /**
  120. * schema property
  121. *
  122. * @var array
  123. * @access protected
  124. */
  125. protected $_schema = array(
  126. 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
  127. 'title' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
  128. 'body' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => ''),
  129. 'number' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
  130. 'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
  131. 'modified' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
  132. );
  133. /**
  134. * validateNumber method
  135. *
  136. * @param mixed $value
  137. * @param mixed $options
  138. * @access public
  139. * @return void
  140. */
  141. public function validateNumber($value, $options) {
  142. $options = array_merge(array('min' => 0, 'max' => 100), $options);
  143. $valid = ($value['number'] >= $options['min'] && $value['number'] <= $options['max']);
  144. return $valid;
  145. }
  146. /**
  147. * validateTitle method
  148. *
  149. * @param mixed $value
  150. * @access public
  151. * @return void
  152. */
  153. public function validateTitle($value) {
  154. return (!empty($value) && strpos(strtolower($value['title']), 'title-') === 0);
  155. }
  156. }
  157. /**
  158. * User class
  159. *
  160. * @package cake.tests.cases.libs.model
  161. */
  162. class User extends CakeTestModel {
  163. /**
  164. * name property
  165. *
  166. * @var string 'User'
  167. * @access public
  168. */
  169. public $name = 'User';
  170. /**
  171. * validate property
  172. *
  173. * @var array
  174. * @access public
  175. */
  176. public $validate = array('user' => 'notEmpty', 'password' => 'notEmpty');
  177. }
  178. /**
  179. * Article class
  180. *
  181. * @package cake.tests.cases.libs.model
  182. */
  183. class Article extends CakeTestModel {
  184. /**
  185. * name property
  186. *
  187. * @var string 'Article'
  188. * @access public
  189. */
  190. public $name = 'Article';
  191. /**
  192. * belongsTo property
  193. *
  194. * @var array
  195. * @access public
  196. */
  197. public $belongsTo = array('User');
  198. /**
  199. * hasMany property
  200. *
  201. * @var array
  202. * @access public
  203. */
  204. public $hasMany = array('Comment' => array('dependent' => true));
  205. /**
  206. * hasAndBelongsToMany property
  207. *
  208. * @var array
  209. * @access public
  210. */
  211. public $hasAndBelongsToMany = array('Tag');
  212. /**
  213. * validate property
  214. *
  215. * @var array
  216. * @access public
  217. */
  218. public $validate = array('user_id' => 'numeric', 'title' => array('allowEmpty' => false, 'rule' => 'notEmpty'), 'body' => 'notEmpty');
  219. /**
  220. * beforeSaveReturn property
  221. *
  222. * @var bool true
  223. * @access public
  224. */
  225. public $beforeSaveReturn = true;
  226. /**
  227. * beforeSave method
  228. *
  229. * @access public
  230. * @return void
  231. */
  232. public function beforeSave($options = array()) {
  233. return $this->beforeSaveReturn;
  234. }
  235. /**
  236. * titleDuplicate method
  237. *
  238. * @param mixed $title
  239. * @access public
  240. * @return void
  241. */
  242. static function titleDuplicate ($title) {
  243. if ($title === 'My Article Title') {
  244. return false;
  245. }
  246. return true;
  247. }
  248. }
  249. /**
  250. * Model stub for beforeDelete testing
  251. *
  252. * @see #250
  253. * @package cake.tests
  254. */
  255. class BeforeDeleteComment extends CakeTestModel {
  256. var $name = 'BeforeDeleteComment';
  257. var $useTable = 'comments';
  258. public function beforeDelete($cascade = true) {
  259. $db = $this->getDataSource();
  260. $db->delete($this, array($this->alias . '.' . $this->primaryKey => array(1, 3)));
  261. return true;
  262. }
  263. }
  264. /**
  265. * NumericArticle class
  266. *
  267. * @package cake.tests.cases.libs.model
  268. */
  269. class NumericArticle extends CakeTestModel {
  270. /**
  271. * name property
  272. *
  273. * @var string 'NumericArticle'
  274. * @access public
  275. */
  276. public $name = 'NumericArticle';
  277. /**
  278. * useTable property
  279. *
  280. * @var string 'numeric_articles'
  281. * @access public
  282. */
  283. public $useTable = 'numeric_articles';
  284. }
  285. /**
  286. * Article10 class
  287. *
  288. * @package cake.tests.cases.libs.model
  289. */
  290. class Article10 extends CakeTestModel {
  291. /**
  292. * name property
  293. *
  294. * @var string 'Article10'
  295. * @access public
  296. */
  297. public $name = 'Article10';
  298. /**
  299. * useTable property
  300. *
  301. * @var string 'articles'
  302. * @access public
  303. */
  304. public $useTable = 'articles';
  305. /**
  306. * hasMany property
  307. *
  308. * @var array
  309. * @access public
  310. */
  311. public $hasMany = array('Comment' => array('dependent' => true, 'exclusive' => true));
  312. }
  313. /**
  314. * ArticleFeatured class
  315. *
  316. * @package cake.tests.cases.libs.model
  317. */
  318. class ArticleFeatured extends CakeTestModel {
  319. /**
  320. * name property
  321. *
  322. * @var string 'ArticleFeatured'
  323. * @access public
  324. */
  325. public $name = 'ArticleFeatured';
  326. /**
  327. * belongsTo property
  328. *
  329. * @var array
  330. * @access public
  331. */
  332. public $belongsTo = array('User', 'Category');
  333. /**
  334. * hasOne property
  335. *
  336. * @var array
  337. * @access public
  338. */
  339. public $hasOne = array('Featured');
  340. /**
  341. * hasMany property
  342. *
  343. * @var array
  344. * @access public
  345. */
  346. public $hasMany = array('Comment' => array('className' => 'Comment', 'dependent' => true));
  347. /**
  348. * hasAndBelongsToMany property
  349. *
  350. * @var array
  351. * @access public
  352. */
  353. public $hasAndBelongsToMany = array('Tag');
  354. /**
  355. * validate property
  356. *
  357. * @var array
  358. * @access public
  359. */
  360. public $validate = array('user_id' => 'numeric', 'title' => 'notEmpty', 'body' => 'notEmpty');
  361. }
  362. /**
  363. * Featured class
  364. *
  365. * @package cake.tests.cases.libs.model
  366. */
  367. class Featured extends CakeTestModel {
  368. /**
  369. * name property
  370. *
  371. * @var string 'Featured'
  372. * @access public
  373. */
  374. public $name = 'Featured';
  375. /**
  376. * belongsTo property
  377. *
  378. * @var array
  379. * @access public
  380. */
  381. public $belongsTo = array('ArticleFeatured', 'Category');
  382. }
  383. /**
  384. * Tag class
  385. *
  386. * @package cake.tests.cases.libs.model
  387. */
  388. class Tag extends CakeTestModel {
  389. /**
  390. * name property
  391. *
  392. * @var string 'Tag'
  393. * @access public
  394. */
  395. public $name = 'Tag';
  396. }
  397. /**
  398. * ArticlesTag class
  399. *
  400. * @package cake.tests.cases.libs.model
  401. */
  402. class ArticlesTag extends CakeTestModel {
  403. /**
  404. * name property
  405. *
  406. * @var string 'ArticlesTag'
  407. * @access public
  408. */
  409. public $name = 'ArticlesTag';
  410. }
  411. /**
  412. * ArticleFeaturedsTag class
  413. *
  414. * @package cake.tests.cases.libs.model
  415. */
  416. class ArticleFeaturedsTag extends CakeTestModel {
  417. /**
  418. * name property
  419. *
  420. * @var string 'ArticleFeaturedsTag'
  421. * @access public
  422. */
  423. public $name = 'ArticleFeaturedsTag';
  424. }
  425. /**
  426. * Comment class
  427. *
  428. * @package cake.tests.cases.libs.model
  429. */
  430. class Comment extends CakeTestModel {
  431. /**
  432. * name property
  433. *
  434. * @var string 'Comment'
  435. * @access public
  436. */
  437. public $name = 'Comment';
  438. /**
  439. * belongsTo property
  440. *
  441. * @var array
  442. * @access public
  443. */
  444. public $belongsTo = array('Article', 'User');
  445. /**
  446. * hasOne property
  447. *
  448. * @var array
  449. * @access public
  450. */
  451. public $hasOne = array('Attachment' => array('dependent' => true));
  452. }
  453. /**
  454. * Modified Comment Class has afterFind Callback
  455. *
  456. * @package cake.tests.cases.libs.model
  457. */
  458. class ModifiedComment extends CakeTestModel {
  459. /**
  460. * name property
  461. *
  462. * @var string 'Comment'
  463. * @access public
  464. */
  465. public $name = 'Comment';
  466. /**
  467. * useTable property
  468. *
  469. * @var string 'comments'
  470. * @access public
  471. */
  472. public $useTable = 'comments';
  473. /**
  474. * belongsTo property
  475. *
  476. * @var array
  477. * @access public
  478. */
  479. public $belongsTo = array('Article');
  480. /**
  481. * afterFind callback
  482. *
  483. * @return void
  484. */
  485. public function afterFind($results, $primary = false) {
  486. if (isset($results[0])) {
  487. $results[0]['Comment']['callback'] = 'Fire';
  488. }
  489. return $results;
  490. }
  491. }
  492. /**
  493. * Modified Comment Class has afterFind Callback
  494. *
  495. * @package cake.tests.cases.libs.model
  496. */
  497. class AgainModifiedComment extends CakeTestModel {
  498. /**
  499. * name property
  500. *
  501. * @var string 'Comment'
  502. * @access public
  503. */
  504. public $name = 'Comment';
  505. /**
  506. * useTable property
  507. *
  508. * @var string 'comments'
  509. * @access public
  510. */
  511. public $useTable = 'comments';
  512. /**
  513. * belongsTo property
  514. *
  515. * @var array
  516. * @access public
  517. */
  518. public $belongsTo = array('Article');
  519. /**
  520. * afterFind callback
  521. *
  522. * @return void
  523. */
  524. public function afterFind($results, $primary = false) {
  525. if (isset($results[0])) {
  526. $results[0]['Comment']['querytype'] = $this->findQueryType;
  527. }
  528. return $results;
  529. }
  530. }
  531. /**
  532. * MergeVarPluginAppModel class
  533. *
  534. * @package cake.tests.cases.libs.model
  535. */
  536. class MergeVarPluginAppModel extends AppModel {
  537. /**
  538. * actsAs parameter
  539. *
  540. * @var array
  541. */
  542. public $actsAs = array(
  543. 'Containable'
  544. );
  545. }
  546. /**
  547. * MergeVarPluginPost class
  548. *
  549. * @package cake.tests.cases.libs.model
  550. */
  551. class MergeVarPluginPost extends MergeVarPluginAppModel {
  552. /**
  553. * actsAs parameter
  554. *
  555. * @var array
  556. */
  557. public $actsAs = array(
  558. 'Tree'
  559. );
  560. /**
  561. * useTable parameter
  562. *
  563. * @var string
  564. */
  565. public $useTable = 'posts';
  566. }
  567. /**
  568. * MergeVarPluginComment class
  569. *
  570. * @package cake.tests.cases.libs.model
  571. */
  572. class MergeVarPluginComment extends MergeVarPluginAppModel {
  573. /**
  574. * actsAs parameter
  575. *
  576. * @var array
  577. */
  578. public $actsAs = array(
  579. 'Containable' => array('some_settings')
  580. );
  581. /**
  582. * useTable parameter
  583. *
  584. * @var string
  585. */
  586. public $useTable = 'comments';
  587. }
  588. /**
  589. * Attachment class
  590. *
  591. * @package cake.tests.cases.libs.model
  592. */
  593. class Attachment extends CakeTestModel {
  594. /**
  595. * name property
  596. *
  597. * @var string 'Attachment'
  598. * @access public
  599. */
  600. public $name = 'Attachment';
  601. }
  602. /**
  603. * Category class
  604. *
  605. * @package cake.tests.cases.libs.model
  606. */
  607. class Category extends CakeTestModel {
  608. /**
  609. * name property
  610. *
  611. * @var string 'Category'
  612. * @access public
  613. */
  614. public $name = 'Category';
  615. }
  616. /**
  617. * CategoryThread class
  618. *
  619. * @package cake.tests.cases.libs.model
  620. */
  621. class CategoryThread extends CakeTestModel {
  622. /**
  623. * name property
  624. *
  625. * @var string 'CategoryThread'
  626. * @access public
  627. */
  628. public $name = 'CategoryThread';
  629. /**
  630. * belongsTo property
  631. *
  632. * @var array
  633. * @access public
  634. */
  635. public $belongsTo = array('ParentCategory' => array('className' => 'CategoryThread', 'foreignKey' => 'parent_id'));
  636. }
  637. /**
  638. * Apple class
  639. *
  640. * @package cake.tests.cases.libs.model
  641. */
  642. class Apple extends CakeTestModel {
  643. /**
  644. * name property
  645. *
  646. * @var string 'Apple'
  647. * @access public
  648. */
  649. public $name = 'Apple';
  650. /**
  651. * validate property
  652. *
  653. * @var array
  654. * @access public
  655. */
  656. public $validate = array('name' => 'notEmpty');
  657. /**
  658. * hasOne property
  659. *
  660. * @var array
  661. * @access public
  662. */
  663. public $hasOne = array('Sample');
  664. /**
  665. * hasMany property
  666. *
  667. * @var array
  668. * @access public
  669. */
  670. public $hasMany = array('Child' => array('className' => 'Apple', 'dependent' => true));
  671. /**
  672. * belongsTo property
  673. *
  674. * @var array
  675. * @access public
  676. */
  677. public $belongsTo = array('Parent' => array('className' => 'Apple', 'foreignKey' => 'apple_id'));
  678. }
  679. /**
  680. * Sample class
  681. *
  682. * @package cake.tests.cases.libs.model
  683. */
  684. class Sample extends CakeTestModel {
  685. /**
  686. * name property
  687. *
  688. * @var string 'Sample'
  689. * @access public
  690. */
  691. public $name = 'Sample';
  692. /**
  693. * belongsTo property
  694. *
  695. * @var string 'Apple'
  696. * @access public
  697. */
  698. public $belongsTo = 'Apple';
  699. }
  700. /**
  701. * AnotherArticle class
  702. *
  703. * @package cake.tests.cases.libs.model
  704. */
  705. class AnotherArticle extends CakeTestModel {
  706. /**
  707. * name property
  708. *
  709. * @var string 'AnotherArticle'
  710. * @access public
  711. */
  712. public $name = 'AnotherArticle';
  713. /**
  714. * hasMany property
  715. *
  716. * @var string 'Home'
  717. * @access public
  718. */
  719. public $hasMany = 'Home';
  720. }
  721. /**
  722. * Advertisement class
  723. *
  724. * @package cake.tests.cases.libs.model
  725. */
  726. class Advertisement extends CakeTestModel {
  727. /**
  728. * name property
  729. *
  730. * @var string 'Advertisement'
  731. * @access public
  732. */
  733. public $name = 'Advertisement';
  734. /**
  735. * hasMany property
  736. *
  737. * @var string 'Home'
  738. * @access public
  739. */
  740. public $hasMany = 'Home';
  741. }
  742. /**
  743. * Home class
  744. *
  745. * @package cake.tests.cases.libs.model
  746. */
  747. class Home extends CakeTestModel {
  748. /**
  749. * name property
  750. *
  751. * @var string 'Home'
  752. * @access public
  753. */
  754. public $name = 'Home';
  755. /**
  756. * belongsTo property
  757. *
  758. * @var array
  759. * @access public
  760. */
  761. public $belongsTo = array('AnotherArticle', 'Advertisement');
  762. }
  763. /**
  764. * Post class
  765. *
  766. * @package cake.tests.cases.libs.model
  767. */
  768. class Post extends CakeTestModel {
  769. /**
  770. * name property
  771. *
  772. * @var string 'Post'
  773. * @access public
  774. */
  775. public $name = 'Post';
  776. /**
  777. * belongsTo property
  778. *
  779. * @var array
  780. * @access public
  781. */
  782. public $belongsTo = array('Author');
  783. public function beforeFind($queryData) {
  784. if (isset($queryData['connection'])) {
  785. $this->useDbConfig = $queryData['connection'];
  786. }
  787. return true;
  788. }
  789. public function afterFind($results, $primary = false) {
  790. $this->useDbConfig = 'test';
  791. return $results;
  792. }
  793. }
  794. /**
  795. * Author class
  796. *
  797. * @package cake.tests.cases.libs.model
  798. */
  799. class Author extends CakeTestModel {
  800. /**
  801. * name property
  802. *
  803. * @var string 'Author'
  804. * @access public
  805. */
  806. public $name = 'Author';
  807. /**
  808. * hasMany property
  809. *
  810. * @var array
  811. * @access public
  812. */
  813. public $hasMany = array('Post');
  814. /**
  815. * afterFind method
  816. *
  817. * @param mixed $results
  818. * @access public
  819. * @return void
  820. */
  821. public function afterFind($results, $primary = false) {
  822. $results[0]['Author']['test'] = 'working';
  823. return $results;
  824. }
  825. }
  826. /**
  827. * ModifiedAuthor class
  828. *
  829. * @package cake.tests.cases.libs.model
  830. */
  831. class ModifiedAuthor extends Author {
  832. /**
  833. * name property
  834. *
  835. * @var string 'Author'
  836. * @access public
  837. */
  838. public $name = 'Author';
  839. /**
  840. * afterFind method
  841. *
  842. * @param mixed $results
  843. * @access public
  844. * @return void
  845. */
  846. public function afterFind($results, $primary = false) {
  847. foreach($results as $index => $result) {
  848. $results[$index]['Author']['user'] .= ' (CakePHP)';
  849. }
  850. return $results;
  851. }
  852. }
  853. /**
  854. * Project class
  855. *
  856. * @package cake.tests.cases.libs.model
  857. */
  858. class Project extends CakeTestModel {
  859. /**
  860. * name property
  861. *
  862. * @var string 'Project'
  863. * @access public
  864. */
  865. public $name = 'Project';
  866. /**
  867. * hasMany property
  868. *
  869. * @var array
  870. * @access public
  871. */
  872. public $hasMany = array('Thread');
  873. }
  874. /**
  875. * Thread class
  876. *
  877. * @package cake.tests.cases.libs.model
  878. */
  879. class Thread extends CakeTestModel {
  880. /**
  881. * name property
  882. *
  883. * @var string 'Thread'
  884. * @access public
  885. */
  886. public $name = 'Thread';
  887. /**
  888. * hasMany property
  889. *
  890. * @var array
  891. * @access public
  892. */
  893. public $belongsTo = array('Project');
  894. /**
  895. * hasMany property
  896. *
  897. * @var array
  898. * @access public
  899. */
  900. public $hasMany = array('Message');
  901. }
  902. /**
  903. * Message class
  904. *
  905. * @package cake.tests.cases.libs.model
  906. */
  907. class Message extends CakeTestModel {
  908. /**
  909. * name property
  910. *
  911. * @var string 'Message'
  912. * @access public
  913. */
  914. public $name = 'Message';
  915. /**
  916. * hasOne property
  917. *
  918. * @var array
  919. * @access public
  920. */
  921. public $hasOne = array('Bid');
  922. }
  923. /**
  924. * Bid class
  925. *
  926. * @package cake.tests.cases.libs.model
  927. */
  928. class Bid extends CakeTestModel {
  929. /**
  930. * name property
  931. *
  932. * @var string 'Bid'
  933. * @access public
  934. */
  935. public $name = 'Bid';
  936. /**
  937. * belongsTo property
  938. *
  939. * @var array
  940. * @access public
  941. */
  942. public $belongsTo = array('Message');
  943. }
  944. /**
  945. * NodeAfterFind class
  946. *
  947. * @package cake.tests.cases.libs.model
  948. */
  949. class NodeAfterFind extends CakeTestModel {
  950. /**
  951. * name property
  952. *
  953. * @var string 'NodeAfterFind'
  954. * @access public
  955. */
  956. public $name = 'NodeAfterFind';
  957. /**
  958. * validate property
  959. *
  960. * @var array
  961. * @access public
  962. */
  963. public $validate = array('name' => 'notEmpty');
  964. /**
  965. * useTable property
  966. *
  967. * @var string 'apples'
  968. * @access public
  969. */
  970. public $useTable = 'apples';
  971. /**
  972. * hasOne property
  973. *
  974. * @var array
  975. * @access public
  976. */
  977. public $hasOne = array('Sample' => array('className' => 'NodeAfterFindSample'));
  978. /**
  979. * hasMany property
  980. *
  981. * @var array
  982. * @access public
  983. */
  984. public $hasMany = array('Child' => array('className' => 'NodeAfterFind', 'dependent' => true));
  985. /**
  986. * belongsTo property
  987. *
  988. * @var array
  989. * @access public
  990. */
  991. public $belongsTo = array('Parent' => array('className' => 'NodeAfterFind', 'foreignKey' => 'apple_id'));
  992. /**
  993. * afterFind method
  994. *
  995. * @param mixed $results
  996. * @access public
  997. * @return void
  998. */
  999. public function afterFind($results, $primary = false) {
  1000. return $results;
  1001. }
  1002. }
  1003. /**
  1004. * NodeAfterFindSample class
  1005. *
  1006. * @package cake.tests.cases.libs.model
  1007. */
  1008. class NodeAfterFindSample extends CakeTestModel {
  1009. /**
  1010. * name property
  1011. *
  1012. * @var string 'NodeAfterFindSample'
  1013. * @access public
  1014. */
  1015. public $name = 'NodeAfterFindSample';
  1016. /**
  1017. * useTable property
  1018. *
  1019. * @var string 'samples'
  1020. * @access public
  1021. */
  1022. public $useTable = 'samples';
  1023. /**
  1024. * belongsTo property
  1025. *
  1026. * @var string 'NodeAfterFind'
  1027. * @access public
  1028. */
  1029. public $belongsTo = 'NodeAfterFind';
  1030. }
  1031. /**
  1032. * NodeNoAfterFind class
  1033. *
  1034. * @package cake.tests.cases.libs.model
  1035. */
  1036. class NodeNoAfterFind extends CakeTestModel {
  1037. /**
  1038. * name property
  1039. *
  1040. * @var string 'NodeAfterFind'
  1041. * @access public
  1042. */
  1043. public $name = 'NodeAfterFind';
  1044. /**
  1045. * validate property
  1046. *
  1047. * @var array
  1048. * @access public
  1049. */
  1050. public $validate = array('name' => 'notEmpty');
  1051. /**
  1052. * useTable property
  1053. *
  1054. * @var string 'apples'
  1055. * @access public
  1056. */
  1057. public $useTable = 'apples';
  1058. /**
  1059. * hasOne property
  1060. *
  1061. * @var array
  1062. * @access public
  1063. */
  1064. public $hasOne = array('Sample' => array('className' => 'NodeAfterFindSample'));
  1065. /**
  1066. * hasMany property
  1067. *
  1068. * @var array
  1069. * @access public
  1070. */
  1071. public $hasMany = array('Child' => array('className' => 'NodeAfterFind', 'dependent' => true));
  1072. /**
  1073. * belongsTo property
  1074. *
  1075. * @var array
  1076. * @access public
  1077. */
  1078. public $belongsTo = array('Parent' => array('className' => 'NodeAfterFind', 'foreignKey' => 'apple_id'));
  1079. }
  1080. /**
  1081. * Node class
  1082. *
  1083. * @package cake.tests.cases.libs.model
  1084. */
  1085. class Node extends CakeTestModel{
  1086. /**
  1087. * name property
  1088. *
  1089. * @var string 'Node'
  1090. * @access public
  1091. */
  1092. public $name = 'Node';
  1093. /**
  1094. * hasAndBelongsToMany property
  1095. *
  1096. * @var array
  1097. * @access public
  1098. */
  1099. public $hasAndBelongsToMany = array(
  1100. 'ParentNode' => array(
  1101. 'className' => 'Node',
  1102. 'joinTable' => 'dependency',
  1103. 'with' => 'Dependency',
  1104. 'foreignKey' => 'child_id',
  1105. 'associationForeignKey' => 'parent_id',
  1106. )
  1107. );
  1108. }
  1109. /**
  1110. * Dependency class
  1111. *
  1112. * @package cake.tests.cases.libs.model
  1113. */
  1114. class Dependency extends CakeTestModel {
  1115. /**
  1116. * name property
  1117. *
  1118. * @var string 'Dependency'
  1119. * @access public
  1120. */
  1121. public $name = 'Dependency';
  1122. }
  1123. /**
  1124. * ModelA class
  1125. *
  1126. * @package cake.tests.cases.libs.model
  1127. */
  1128. class ModelA extends CakeTestModel {
  1129. /**
  1130. * name property
  1131. *
  1132. * @var string 'ModelA'
  1133. * @access public
  1134. */
  1135. public $name = 'ModelA';
  1136. /**
  1137. * useTable property
  1138. *
  1139. * @var string 'apples'
  1140. * @access public
  1141. */
  1142. public $useTable = 'apples';
  1143. /**
  1144. * hasMany property
  1145. *
  1146. * @var array
  1147. * @access public
  1148. */
  1149. public $hasMany = array('ModelB', 'ModelC');
  1150. }
  1151. /**
  1152. * ModelB class
  1153. *
  1154. * @package cake.tests.cases.libs.model
  1155. */
  1156. class ModelB extends CakeTestModel {
  1157. /**
  1158. * name property
  1159. *
  1160. * @var string 'ModelB'
  1161. * @access public
  1162. */
  1163. public $name = 'ModelB';
  1164. /**
  1165. * useTable property
  1166. *
  1167. * @var string 'messages'
  1168. * @access public
  1169. */
  1170. public $useTable = 'messages';
  1171. /**
  1172. * hasMany property
  1173. *
  1174. * @var array
  1175. * @access public
  1176. */
  1177. public $hasMany = array('ModelD');
  1178. }
  1179. /**
  1180. * ModelC class
  1181. *
  1182. * @package cake.tests.cases.libs.model
  1183. */
  1184. class ModelC extends CakeTestModel {
  1185. /**
  1186. * name property
  1187. *
  1188. * @var string 'ModelC'
  1189. * @access public
  1190. */
  1191. public $name = 'ModelC';
  1192. /**
  1193. * useTable property
  1194. *
  1195. * @var string 'bids'
  1196. * @access public
  1197. */
  1198. public $useTable = 'bids';
  1199. /**
  1200. * hasMany property
  1201. *
  1202. * @var array
  1203. * @access public
  1204. */
  1205. public $hasMany = array('ModelD');
  1206. }
  1207. /**
  1208. * ModelD class
  1209. *
  1210. * @package cake.tests.cases.libs.model
  1211. */
  1212. class ModelD extends CakeTestModel {
  1213. /**
  1214. * name property
  1215. *
  1216. * @var string 'ModelD'
  1217. * @access public
  1218. */
  1219. public $name = 'ModelD';
  1220. /**
  1221. * useTable property
  1222. *
  1223. * @var string 'threads'
  1224. * @access public
  1225. */
  1226. public $useTable = 'threads';
  1227. }
  1228. /**
  1229. * Something class
  1230. *
  1231. * @package cake.tests.cases.libs.model
  1232. */
  1233. class Something extends CakeTestModel {
  1234. /**
  1235. * name property
  1236. *
  1237. * @var string 'Something'
  1238. * @access public
  1239. */
  1240. public $name = 'Something';
  1241. /**
  1242. * hasAndBelongsToMany property
  1243. *
  1244. * @var array
  1245. * @access public
  1246. */
  1247. public $hasAndBelongsToMany = array('SomethingElse' => array('with' => array('JoinThing' => array('doomed'))));
  1248. }
  1249. /**
  1250. * SomethingElse class
  1251. *
  1252. * @package cake.tests.cases.libs.model
  1253. */
  1254. class SomethingElse extends CakeTestModel {
  1255. /**
  1256. * name property
  1257. *
  1258. * @var string 'SomethingElse'
  1259. * @access public
  1260. */
  1261. public $name = 'SomethingElse';
  1262. /**
  1263. * hasAndBelongsToMany property
  1264. *
  1265. * @var array
  1266. * @access public
  1267. */
  1268. public $hasAndBelongsToMany = array('Something' => array('with' => 'JoinThing'));
  1269. }
  1270. /**
  1271. * JoinThing class
  1272. *
  1273. * @package cake.tests.cases.libs.model
  1274. */
  1275. class JoinThing extends CakeTestModel {
  1276. /**
  1277. * name property
  1278. *
  1279. * @var string 'JoinThing'
  1280. * @access public
  1281. */
  1282. public $name = 'JoinThing';
  1283. /**
  1284. * belongsTo property
  1285. *
  1286. * @var array
  1287. * @access public
  1288. */
  1289. public $belongsTo = array('Something', 'SomethingElse');
  1290. }
  1291. /**
  1292. * Portfolio class
  1293. *
  1294. * @package cake.tests.cases.libs.model
  1295. */
  1296. class Portfolio extends CakeTestModel {
  1297. /**
  1298. * name property
  1299. *
  1300. * @var string 'Portfolio'
  1301. * @access public
  1302. */
  1303. public $name = 'Portfolio';
  1304. /**
  1305. * hasAndBelongsToMany property
  1306. *
  1307. * @var array
  1308. * @access public
  1309. */
  1310. public $hasAndBelongsToMany = array('Item');
  1311. }
  1312. /**
  1313. * Item class
  1314. *
  1315. * @package cake.tests.cases.libs.model
  1316. */
  1317. class Item extends CakeTestModel {
  1318. /**
  1319. * name property
  1320. *
  1321. * @var string 'Item'
  1322. * @access public
  1323. */
  1324. public $name = 'Item';
  1325. /**
  1326. * belongsTo property
  1327. *
  1328. * @var array
  1329. * @access public
  1330. */
  1331. public $belongsTo = array('Syfile' => array('counterCache' => true));
  1332. /**
  1333. * hasAndBelongsToMany property
  1334. *
  1335. * @var array
  1336. * @access public
  1337. */
  1338. public $hasAndBelongsToMany = array('Portfolio' => array('unique' => false));
  1339. }
  1340. /**
  1341. * ItemsPortfolio class
  1342. *
  1343. * @package cake.tests.cases.libs.model
  1344. */
  1345. class ItemsPortfolio extends CakeTestModel {
  1346. /**
  1347. * name property
  1348. *
  1349. * @var string 'ItemsPortfolio'
  1350. * @access public
  1351. */
  1352. public $name = 'ItemsPortfolio';
  1353. }
  1354. /**
  1355. * Syfile class
  1356. *
  1357. * @package cake.tests.cases.libs.model
  1358. */
  1359. class Syfile extends CakeTestModel {
  1360. /**
  1361. * name property
  1362. *
  1363. * @var string 'Syfile'
  1364. * @access public
  1365. */
  1366. public $name = 'Syfile';
  1367. /**
  1368. * belongsTo property
  1369. *
  1370. * @var array
  1371. * @access public
  1372. */
  1373. public $belongsTo = array('Image');
  1374. }
  1375. /**
  1376. * Image class
  1377. *
  1378. * @package cake.tests.cases.libs.model
  1379. */
  1380. class Image extends CakeTestModel {
  1381. /**
  1382. * name property
  1383. *
  1384. * @var string 'Image'
  1385. * @access public
  1386. */
  1387. public $name = 'Image';
  1388. }
  1389. /**
  1390. * DeviceType class
  1391. *
  1392. * @package cake.tests.cases.libs.model
  1393. */
  1394. class DeviceType extends CakeTestModel {
  1395. /**
  1396. * name property
  1397. *
  1398. * @var string 'DeviceType'
  1399. * @access public
  1400. */
  1401. public $name = 'DeviceType';
  1402. /**
  1403. * order property
  1404. *
  1405. * @var array
  1406. * @access public
  1407. */
  1408. public $order = array('DeviceType.order' => 'ASC');
  1409. /**
  1410. * belongsTo property
  1411. *
  1412. * @var array
  1413. * @access public
  1414. */
  1415. public $belongsTo = array(
  1416. 'DeviceTypeCategory', 'FeatureSet', 'ExteriorTypeCategory',
  1417. 'Image' => array('className' => 'Document'),
  1418. 'Extra1' => array('className' => 'Document'),
  1419. 'Extra2' => array('className' => 'Document'));
  1420. /**
  1421. * hasMany property
  1422. *
  1423. * @var array
  1424. * @access public
  1425. */
  1426. public $hasMany = array('Device' => array('order' => array('Device.id' => 'ASC')));
  1427. }
  1428. /**
  1429. * DeviceTypeCategory class
  1430. *
  1431. * @package cake.tests.cases.libs.model
  1432. */
  1433. class DeviceTypeCategory extends CakeTestModel {
  1434. /**
  1435. * name property
  1436. *
  1437. * @var string 'DeviceTypeCategory'
  1438. * @access public
  1439. */
  1440. public $name = 'DeviceTypeCategory';
  1441. }
  1442. /**
  1443. * FeatureSet class
  1444. *
  1445. * @package cake.tests.cases.libs.model
  1446. */
  1447. class FeatureSet extends CakeTestModel {
  1448. /**
  1449. * name property
  1450. *
  1451. * @var string 'FeatureSet'
  1452. * @access public
  1453. */
  1454. public $name = 'FeatureSet';
  1455. }
  1456. /**
  1457. * ExteriorTypeCategory class
  1458. *
  1459. * @package cake.tests.cases.libs.model
  1460. */
  1461. class ExteriorTypeCategory extends CakeTestModel {
  1462. /**
  1463. * name property
  1464. *
  1465. * @var string 'ExteriorTypeCategory'
  1466. * @access public
  1467. */
  1468. public $name = 'ExteriorTypeCategory';
  1469. /**
  1470. * belongsTo property
  1471. *
  1472. * @var array
  1473. * @access public
  1474. */
  1475. public $belongsTo = array('Image' => array('className' => 'Device'));
  1476. }
  1477. /**
  1478. * Document class
  1479. *
  1480. * @package cake.tests.cases.libs.model
  1481. */
  1482. class Document extends CakeTestModel {
  1483. /**
  1484. * name property
  1485. *
  1486. * @var string 'Document'
  1487. * @access public
  1488. */
  1489. public $name = 'Document';
  1490. /**
  1491. * belongsTo property
  1492. *
  1493. * @var array
  1494. * @access public
  1495. */
  1496. public $belongsTo = array('DocumentDirectory');
  1497. }
  1498. /**
  1499. * Device class
  1500. *
  1501. * @package cake.tests.cases.libs.model
  1502. */
  1503. class Device extends CakeTestModel {
  1504. /**
  1505. * name property
  1506. *
  1507. * @var string 'Device'
  1508. * @access public
  1509. */
  1510. public $name = 'Device';
  1511. }
  1512. /**
  1513. * DocumentDirectory class
  1514. *
  1515. * @package cake.tests.cases.libs.model
  1516. */
  1517. class DocumentDirectory extends CakeTestModel {
  1518. /**
  1519. * name property
  1520. *
  1521. * @var string 'DocumentDirectory'
  1522. * @access public
  1523. */
  1524. public $name = 'DocumentDirectory';
  1525. }
  1526. /**
  1527. * PrimaryModel class
  1528. *
  1529. * @package cake.tests.cases.libs.model
  1530. */
  1531. class PrimaryModel extends CakeTestModel {
  1532. /**
  1533. * name property
  1534. *
  1535. * @var string 'PrimaryModel'
  1536. * @access public
  1537. */
  1538. public $name = 'PrimaryModel';
  1539. }
  1540. /**
  1541. * SecondaryModel class
  1542. *
  1543. * @package cake.tests.cases.libs.model
  1544. */
  1545. class SecondaryModel extends CakeTestModel {
  1546. /**
  1547. * name property
  1548. *
  1549. * @var string 'SecondaryModel'
  1550. * @access public
  1551. */
  1552. public $name = 'SecondaryModel';
  1553. }
  1554. /**
  1555. * JoinA class
  1556. *
  1557. * @package cake.tests.cases.libs.model
  1558. */
  1559. class JoinA extends CakeTestModel {
  1560. /**
  1561. * name property
  1562. *
  1563. * @var string 'JoinA'
  1564. * @access public
  1565. */
  1566. public $name = 'JoinA';
  1567. /**
  1568. * hasAndBelongsToMany property
  1569. *
  1570. * @var array
  1571. * @access public
  1572. */
  1573. public $hasAndBelongsToMany = array('JoinB', 'JoinC');
  1574. }
  1575. /**
  1576. * JoinB class
  1577. *
  1578. * @package cake.tests.cases.libs.model
  1579. */
  1580. class JoinB extends CakeTestModel {
  1581. /**
  1582. * name property
  1583. *
  1584. * @var string 'JoinB'
  1585. * @access public
  1586. */
  1587. public $name = 'JoinB';
  1588. /**
  1589. * hasAndBelongsToMany property
  1590. *
  1591. * @var array
  1592. * @access public
  1593. */
  1594. public $hasAndBelongsToMany = array('JoinA');
  1595. }
  1596. /**
  1597. * JoinC class
  1598. *
  1599. * @package cake.tests.cases.libs.model
  1600. */
  1601. class JoinC extends CakeTestModel {
  1602. /**
  1603. * name property
  1604. *
  1605. * @var string 'JoinC'
  1606. * @access public
  1607. */
  1608. public $name = 'JoinC';
  1609. /**
  1610. * hasAndBelongsToMany property
  1611. *
  1612. * @var array
  1613. * @access public
  1614. */
  1615. public $hasAndBelongsToMany = array('JoinA');
  1616. }
  1617. /**
  1618. * ThePaper class
  1619. *
  1620. * @package cake.tests.cases.libs.model
  1621. */
  1622. class ThePaper extends CakeTestModel {
  1623. /**
  1624. * name property
  1625. *
  1626. * @var string 'ThePaper'
  1627. * @access public
  1628. */
  1629. public $name = 'ThePaper';
  1630. /**
  1631. * useTable property
  1632. *
  1633. * @var string 'apples'
  1634. * @access public
  1635. */
  1636. public $useTable = 'apples';
  1637. /**
  1638. * hasOne property
  1639. *
  1640. * @var array
  1641. * @access public
  1642. */
  1643. public $hasOne = array('Itself' => array('className' => 'ThePaper', 'foreignKey' => 'apple_id'));
  1644. /**
  1645. * hasAndBelongsToMany property
  1646. *
  1647. * @var array
  1648. * @access public
  1649. */
  1650. public $hasAndBelongsToMany = array('Monkey' => array('joinTable' => 'the_paper_monkies', 'order' => 'id'));
  1651. }
  1652. /**
  1653. * Monkey class
  1654. *
  1655. * @package cake.tests.cases.libs.model
  1656. */
  1657. class Monkey extends CakeTestModel {
  1658. /**
  1659. * name property
  1660. *
  1661. * @var string 'Monkey'
  1662. * @access public
  1663. */
  1664. public $name = 'Monkey';
  1665. /**
  1666. * useTable property
  1667. *
  1668. * @var string 'devices'
  1669. * @access public
  1670. */
  1671. public $useTable = 'devices';
  1672. }
  1673. /**
  1674. * AssociationTest1 class
  1675. *
  1676. * @package cake.tests.cases.libs.model
  1677. */
  1678. class AssociationTest1 extends CakeTestModel {
  1679. /**
  1680. * useTable property
  1681. *
  1682. * @var string 'join_as'
  1683. * @access public
  1684. */
  1685. public $useTable = 'join_as';
  1686. /**
  1687. * name property
  1688. *
  1689. * @var string 'AssociationTest1'
  1690. * @access public
  1691. */
  1692. public $name = 'AssociationTest1';
  1693. /**
  1694. * hasAndBelongsToMany property
  1695. *
  1696. * @var array
  1697. * @access public
  1698. */
  1699. public $hasAndBelongsToMany = array('AssociationTest2' => array(
  1700. 'unique' => false, 'joinTable' => 'join_as_join_bs', 'foreignKey' => false
  1701. ));
  1702. }
  1703. /**
  1704. * AssociationTest2 class
  1705. *
  1706. * @package cake.tests.cases.libs.model
  1707. */
  1708. class AssociationTest2 extends CakeTestModel {
  1709. /**
  1710. * useTable property
  1711. *
  1712. * @var string 'join_bs'
  1713. * @access public
  1714. */
  1715. public $useTable = 'join_bs';
  1716. /**
  1717. * name property
  1718. *
  1719. * @var string 'AssociationTest2'
  1720. * @access public
  1721. */
  1722. public $name = 'AssociationTest2';
  1723. /**
  1724. * hasAndBelongsToMany property
  1725. *
  1726. * @var array
  1727. * @access public
  1728. */
  1729. public $hasAndBelongsToMany = array('AssociationTest1' => array(
  1730. 'unique' => false, 'joinTable' => 'join_as_join_bs'
  1731. ));
  1732. }
  1733. /**
  1734. * Callback class
  1735. *
  1736. * @package cake.tests.cases.libs.model
  1737. */
  1738. class Callback extends CakeTestModel {
  1739. }
  1740. /**
  1741. * CallbackPostTestModel class
  1742. *
  1743. * @package cake.tests.cases.libs.model
  1744. */
  1745. class CallbackPostTestModel extends CakeTestModel {
  1746. public $useTable = 'posts';
  1747. /**
  1748. * variable to control return of beforeValidate
  1749. *
  1750. * @var string
  1751. */
  1752. public $beforeValidateReturn = true;
  1753. /**
  1754. * variable to control return of beforeSave
  1755. *
  1756. * @var string
  1757. */
  1758. public $beforeSaveReturn = true;
  1759. /**
  1760. * variable to control return of beforeDelete
  1761. *
  1762. * @var string
  1763. */
  1764. public $beforeDeleteReturn = true;
  1765. /**
  1766. * beforeSave callback
  1767. *
  1768. * @return void
  1769. */
  1770. public function beforeSave($options = array()) {
  1771. return $this->beforeSaveReturn;
  1772. }
  1773. /**
  1774. * beforeValidate callback
  1775. *
  1776. * @return void
  1777. */
  1778. public function beforeValidate($options = array()) {
  1779. return $this->beforeValidateReturn;
  1780. }
  1781. /**
  1782. * beforeDelete callback
  1783. *
  1784. * @return void
  1785. */
  1786. public function beforeDelete($cascade = true) {
  1787. return $this->beforeDeleteReturn;
  1788. }
  1789. }
  1790. /**
  1791. * Uuid class
  1792. *
  1793. * @package cake.tests.cases.libs.model
  1794. */
  1795. class Uuid extends CakeTestModel {
  1796. /**
  1797. * name property
  1798. *
  1799. * @var string 'Uuid'
  1800. * @access public
  1801. */
  1802. public $name = 'Uuid';
  1803. }
  1804. /**
  1805. * DataTest class
  1806. *
  1807. * @package cake.tests.cases.libs.model
  1808. */
  1809. class DataTest extends CakeTestModel {
  1810. /**
  1811. * name property
  1812. *
  1813. * @var string 'DataTest'
  1814. * @access public
  1815. */
  1816. public $name = 'DataTest';
  1817. }
  1818. /**
  1819. * TheVoid class
  1820. *
  1821. * @package cake.tests.cases.libs.model
  1822. */
  1823. class TheVoid extends CakeTestModel {
  1824. /**
  1825. * name property
  1826. *
  1827. * @var string 'TheVoid'
  1828. * @access public
  1829. */
  1830. public $name = 'TheVoid';
  1831. /**
  1832. * useTable property
  1833. *
  1834. * @var bool false
  1835. * @access public
  1836. */
  1837. public $useTable = false;
  1838. }
  1839. /**
  1840. * ValidationTest1 class
  1841. *
  1842. * @package cake.tests.cases.libs.model
  1843. */
  1844. class ValidationTest1 extends CakeTestModel {
  1845. /**
  1846. * name property
  1847. *
  1848. * @var string 'ValidationTest'
  1849. * @access public
  1850. */
  1851. public $name = 'ValidationTest1';
  1852. /**
  1853. * useTable property
  1854. *
  1855. * @var bool false
  1856. * @access public
  1857. */
  1858. public $useTable = false;
  1859. /**
  1860. * schema property
  1861. *
  1862. * @var array
  1863. * @access protected
  1864. */
  1865. protected $_schema = array();
  1866. /**
  1867. * validate property
  1868. *
  1869. * @var array
  1870. * @access public
  1871. */
  1872. public $validate = array(
  1873. 'title' => 'notEmpty',
  1874. 'published' => 'customValidationMethod',
  1875. 'body' => array(
  1876. 'notEmpty',
  1877. '/^.{5,}$/s' => 'no matchy',
  1878. '/^[0-9A-Za-z \\.]{1,}$/s'
  1879. )
  1880. );
  1881. /**
  1882. * customValidationMethod method
  1883. *
  1884. * @param mixed $data
  1885. * @access public
  1886. * @return void
  1887. */
  1888. public function customValidationMethod($data) {
  1889. return $data === 1;
  1890. }
  1891. /**
  1892. * Custom validator with parameters + default values
  1893. *
  1894. * @access public
  1895. * @return array
  1896. */
  1897. public function customValidatorWithParams($data, $validator, $or = true, $ignore_on_same = 'id') {
  1898. $this->validatorParams = get_defined_vars();
  1899. unset($this->validatorParams['this']);
  1900. return true;
  1901. }
  1902. /**
  1903. * Custom validator with messaage
  1904. *
  1905. * @access public
  1906. * @return array
  1907. */
  1908. public function customValidatorWithMessage($data) {
  1909. return 'This field will *never* validate! Muhahaha!';
  1910. }
  1911. /**
  1912. * Test validation with many parameters
  1913. *
  1914. * @return void
  1915. */
  1916. public function customValidatorWithSixParams($data, $one = 1, $two = 2, $three = 3, $four = 4, $five = 5, $six = 6) {
  1917. $this->validatorParams = get_defined_vars();
  1918. unset($this->validatorParams['this']);
  1919. return true;
  1920. }
  1921. }
  1922. /**
  1923. * ValidationTest2 class
  1924. *
  1925. * @package cake.tests.cases.libs.model
  1926. */
  1927. class ValidationTest2 extends CakeTestModel {
  1928. /**
  1929. * name property
  1930. *
  1931. * @var string 'ValidationTest2'
  1932. * @access public
  1933. */
  1934. public $name = 'ValidationTest2';
  1935. /**
  1936. * useTable property
  1937. *
  1938. * @var bool false
  1939. * @access public
  1940. */
  1941. public $useTable = false;
  1942. /**
  1943. * validate property
  1944. *
  1945. * @var array
  1946. * @access public
  1947. */
  1948. public $validate = array(
  1949. 'title' => 'notEmpty',
  1950. 'published' => 'customValidationMethod',
  1951. 'body' => array(
  1952. 'notEmpty',
  1953. '/^.{5,}$/s' => 'no matchy',
  1954. '/^[0-9A-Za-z \\.]{1,}$/s'
  1955. )
  1956. );
  1957. /**
  1958. * customValidationMethod method
  1959. *
  1960. * @param mixed $data
  1961. * @access public
  1962. * @return void
  1963. */
  1964. public function customValidationMethod($data) {
  1965. return $data === 1;
  1966. }
  1967. /**
  1968. * schema method
  1969. *
  1970. * @access public
  1971. * @return void
  1972. */
  1973. public function schema($field = false) {
  1974. return array();
  1975. }
  1976. }
  1977. /**
  1978. * Person class
  1979. *
  1980. * @package cake.tests.cases.libs.model
  1981. */
  1982. class Person extends CakeTestModel {
  1983. /**
  1984. * name property
  1985. *
  1986. * @var string 'Person'
  1987. * @access public
  1988. */
  1989. public $name = 'Person';
  1990. /**
  1991. * belongsTo property
  1992. *
  1993. * @var array
  1994. * @access public
  1995. */
  1996. public $belongsTo = array(
  1997. 'Mother' => array(
  1998. 'className' => 'Person',
  1999. 'foreignKey' => 'mother_id'),
  2000. 'Father' => array(
  2001. 'className' => 'Person',
  2002. 'foreignKey' => 'father_id'));
  2003. }
  2004. /**
  2005. * UnderscoreField class
  2006. *
  2007. * @package cake.tests.cases.libs.model
  2008. */
  2009. class UnderscoreField extends CakeTestModel {
  2010. /**
  2011. * name property
  2012. *
  2013. * @var string 'UnderscoreField'
  2014. * @access public
  2015. */
  2016. public $name = 'UnderscoreField';
  2017. }
  2018. /**
  2019. * Product class
  2020. *
  2021. * @package cake.tests.cases.libs.model
  2022. */
  2023. class Product extends CakeTestModel {
  2024. /**
  2025. * name property
  2026. *
  2027. * @var string 'Product'
  2028. * @access public
  2029. */
  2030. public $name = 'Product';
  2031. }
  2032. /**
  2033. * Story class
  2034. *
  2035. * @package cake.tests.cases.libs.model
  2036. */
  2037. class Story extends CakeTestModel {
  2038. /**
  2039. * name property
  2040. *
  2041. * @var string 'Story'
  2042. * @access public
  2043. */
  2044. public $name = 'Story';
  2045. /**
  2046. * primaryKey property
  2047. *
  2048. * @var string 'story'
  2049. * @access public
  2050. */
  2051. public $primaryKey = 'story';
  2052. /**
  2053. * hasAndBelongsToMany property
  2054. *
  2055. * @var array
  2056. * @access public
  2057. */
  2058. public $hasAndBelongsToMany = array('Tag' => array('foreignKey' => 'story'));
  2059. /**
  2060. * validate property
  2061. *
  2062. * @var array
  2063. * @access public
  2064. */
  2065. public $validate = array('title' => 'notEmpty');
  2066. }
  2067. /**
  2068. * Cd class
  2069. *
  2070. * @package cake.tests.cases.libs.model
  2071. */
  2072. class Cd extends CakeTestModel {
  2073. /**
  2074. * name property
  2075. *
  2076. * @var string 'Cd'
  2077. * @access public
  2078. */
  2079. public $name = 'Cd';
  2080. /**
  2081. * hasOne property
  2082. *
  2083. * @var array
  2084. * @access public
  2085. */
  2086. public $hasOne = array('OverallFavorite' => array('foreignKey' => 'model_id', 'dependent' => true, 'conditions' => array('model_type' => 'Cd')));
  2087. }
  2088. /**
  2089. * Book class
  2090. *
  2091. * @package cake.tests.cases.libs.model
  2092. */
  2093. class Book extends CakeTestModel {
  2094. /**
  2095. * name property
  2096. *
  2097. * @var string 'Book'
  2098. * @access public
  2099. */
  2100. public $name = 'Book';
  2101. /**
  2102. * hasOne property
  2103. *
  2104. * @var array
  2105. * @access public
  2106. */
  2107. public $hasOne = array('OverallFavorite' => array('foreignKey' => 'model_id', 'dependent' => true, 'conditions' => 'OverallFavorite.model_type = \'Book\''));
  2108. }
  2109. /**
  2110. * OverallFavorite class
  2111. *
  2112. * @package cake.tests.cases.libs.model
  2113. */
  2114. class OverallFavorite extends CakeTestModel {
  2115. /**
  2116. * name property
  2117. *
  2118. * @var string 'OverallFavorite'
  2119. * @access public
  2120. */
  2121. public $name = 'OverallFavorite';
  2122. }
  2123. /**
  2124. * MyUser class
  2125. *
  2126. * @package cake.tests.cases.libs.model
  2127. */
  2128. class MyUser extends CakeTestModel {
  2129. /**
  2130. * name property
  2131. *
  2132. * @var string 'MyUser'
  2133. * @access public
  2134. */
  2135. public $name = 'MyUser';
  2136. /**
  2137. * undocumented variable
  2138. *
  2139. * @var string
  2140. * @access public
  2141. */
  2142. public $hasAndBelongsToMany = array('MyCategory');
  2143. }
  2144. /**
  2145. * MyCategory class
  2146. *
  2147. * @package cake.tests.cases.libs.model
  2148. */
  2149. class MyCategory extends CakeTestModel {
  2150. /**
  2151. * name property
  2152. *
  2153. * @var string 'MyCategory'
  2154. * @access public
  2155. */
  2156. public $name = 'MyCategory';
  2157. /**
  2158. * undocumented variable
  2159. *
  2160. * @var string
  2161. * @access public
  2162. */
  2163. public $hasAndBelongsToMany = array('MyProduct', 'MyUser');
  2164. }
  2165. /**
  2166. * MyProduct class
  2167. *
  2168. * @package cake.tests.cases.libs.model
  2169. */
  2170. class MyProduct extends CakeTestModel {
  2171. /**
  2172. * name property
  2173. *
  2174. * @var string 'MyProduct'
  2175. * @access public
  2176. */
  2177. public $name = 'MyProduct';
  2178. /**
  2179. * undocumented variable
  2180. *
  2181. * @var string
  2182. * @access public
  2183. */
  2184. public $hasAndBelongsToMany = array('MyCategory');
  2185. }
  2186. /**
  2187. * MyCategoriesMyUser class
  2188. *
  2189. * @package cake.tests.cases.libs.model
  2190. */
  2191. class MyCategoriesMyUser extends CakeTestModel {
  2192. /**
  2193. * name property
  2194. *
  2195. * @var string 'MyCategoriesMyUser'
  2196. * @access public
  2197. */
  2198. public $name = 'MyCategoriesMyUser';
  2199. }
  2200. /**
  2201. * MyCategoriesMyProduct class
  2202. *
  2203. * @package cake.tests.cases.libs.model
  2204. */
  2205. class MyCategoriesMyProduct extends CakeTestModel {
  2206. /**
  2207. * name property
  2208. *
  2209. * @var string 'MyCategoriesMyProduct'
  2210. * @access public
  2211. */
  2212. public $name = 'MyCategoriesMyProduct';
  2213. }
  2214. /**
  2215. * NumberTree class
  2216. *
  2217. * @package cake.tests.cases.libs.model
  2218. */
  2219. class NumberTree extends CakeTestModel {
  2220. /**
  2221. * name property
  2222. *
  2223. * @var string 'NumberTree'
  2224. * @access public
  2225. */
  2226. public $name = 'NumberTree';
  2227. /**
  2228. * actsAs property
  2229. *
  2230. * @var array
  2231. * @access public
  2232. */
  2233. public $actsAs = array('Tree');
  2234. /**
  2235. * initialize method
  2236. *
  2237. * @param int $levelLimit
  2238. * @param int $childLimit
  2239. * @param mixed $currentLevel
  2240. * @param mixed $parent_id
  2241. * @param string $prefix
  2242. * @param bool $hierachial
  2243. * @access public
  2244. * @return void
  2245. */
  2246. public function initialize($levelLimit = 3, $childLimit = 3, $currentLevel = null, $parent_id = null, $prefix = '1', $hierachial = true) {
  2247. if (!$parent_id) {
  2248. $db = ConnectionManager::getDataSource($this->useDbConfig);
  2249. $db->truncate($this->table);
  2250. $this->save(array($this->name => array('name' => '1. Root')));
  2251. $this->initialize($levelLimit, $childLimit, 1, $this->id, '1', $hierachial);
  2252. $this->create(array());
  2253. }
  2254. if (!$currentLevel || $currentLevel > $levelLimit) {
  2255. return;
  2256. }
  2257. for ($i = 1; $i <= $childLimit; $i++) {
  2258. $name = $prefix . '.' . $i;
  2259. $data = array($this->name => array('name' => $name));
  2260. $this->create($data);
  2261. if ($hierachial) {
  2262. if ($this->name == 'UnconventionalTree') {
  2263. $data[$this->name]['join'] = $parent_id;
  2264. } else {
  2265. $data[$this->name]['parent_id'] = $parent_id;
  2266. }
  2267. }
  2268. $this->save($data);
  2269. $this->initialize($levelLimit, $childLimit, $currentLevel + 1, $this->id, $name, $hierachial);
  2270. }
  2271. }
  2272. }
  2273. /**
  2274. * NumberTreeTwo class
  2275. *
  2276. * @package cake.tests.cases.libs.model
  2277. */
  2278. class NumberTreeTwo extends NumberTree {
  2279. /**
  2280. * name property
  2281. *
  2282. * @var string 'NumberTree'
  2283. * @access public
  2284. */
  2285. public $name = 'NumberTreeTwo';
  2286. /**
  2287. * actsAs property
  2288. *
  2289. * @var array
  2290. * @access public
  2291. */
  2292. public $actsAs = array();
  2293. }
  2294. /**
  2295. * FlagTree class
  2296. *
  2297. * @package cake.tests.cases.libs.model
  2298. */
  2299. class FlagTree extends NumberTree {
  2300. /**
  2301. * name property
  2302. *
  2303. * @var string 'FlagTree'
  2304. * @access public
  2305. */
  2306. public $name = 'FlagTree';
  2307. }
  2308. /**
  2309. * UnconventionalTree class
  2310. *
  2311. * @package cake.tests.cases.libs.model
  2312. */
  2313. class UnconventionalTree extends NumberTree {
  2314. /**
  2315. * name property
  2316. *
  2317. * @var string 'FlagTree'
  2318. * @access public
  2319. */
  2320. public $name = 'UnconventionalTree';
  2321. public $actsAs = array(
  2322. 'Tree' => array(
  2323. 'parent' => 'join',
  2324. 'left' => 'left',
  2325. 'right' => 'right'
  2326. )
  2327. );
  2328. }
  2329. /**
  2330. * UuidTree class
  2331. *
  2332. * @package cake.tests.cases.libs.model
  2333. */
  2334. class UuidTree extends NumberTree {
  2335. /**
  2336. * name property
  2337. *
  2338. * @var string 'FlagTree'
  2339. * @access public
  2340. */
  2341. public $name = 'UuidTree';
  2342. }
  2343. /**
  2344. * Campaign class
  2345. *
  2346. * @package cake.tests.cases.libs.model
  2347. */
  2348. class Campaign extends CakeTestModel {
  2349. /**
  2350. * name property
  2351. *
  2352. * @var string 'Campaign'
  2353. * @access public
  2354. */
  2355. public $name = 'Campaign';
  2356. /**
  2357. * hasMany property
  2358. *
  2359. * @var array
  2360. * @access public
  2361. */
  2362. public $hasMany = array('Ad' => array('fields' => array('id','campaign_id','name')));
  2363. }
  2364. /**
  2365. * Ad class
  2366. *
  2367. * @package cake.tests.cases.libs.model
  2368. */
  2369. class Ad extends CakeTestModel {
  2370. /**
  2371. * name property
  2372. *
  2373. * @var string 'Ad'
  2374. * @access public
  2375. */
  2376. public $name = 'Ad';
  2377. /**
  2378. * actsAs property
  2379. *
  2380. * @var array
  2381. * @access public
  2382. */
  2383. public $actsAs = array('Tree');
  2384. /**
  2385. * belongsTo property
  2386. *
  2387. * @var array
  2388. * @access public
  2389. */
  2390. public $belongsTo = array('Campaign');
  2391. }
  2392. /**
  2393. * AfterTree class
  2394. *
  2395. * @package cake.tests.cases.libs.model
  2396. */
  2397. class AfterTree extends NumberTree {
  2398. /**
  2399. * name property
  2400. *
  2401. * @var string 'AfterTree'
  2402. * @access public
  2403. */
  2404. public $name = 'AfterTree';
  2405. /**
  2406. * actsAs property
  2407. *
  2408. * @var array
  2409. * @access public
  2410. */
  2411. public $actsAs = array('Tree');
  2412. public function afterSave($created) {
  2413. if ($created && isset($this->data['AfterTree'])) {
  2414. $this->data['AfterTree']['name'] = 'Six and One Half Changed in AfterTree::afterSave() but not in database';
  2415. }
  2416. }
  2417. }
  2418. /**
  2419. * Nonconformant Content class
  2420. *
  2421. * @package cake.tests.cases.libs.model
  2422. */
  2423. class Content extends CakeTestModel {
  2424. /**
  2425. * name property
  2426. *
  2427. * @var string 'Content'
  2428. * @access public
  2429. */
  2430. public $name = 'Content';
  2431. /**
  2432. * useTable property
  2433. *
  2434. * @var string 'Content'
  2435. * @access public
  2436. */
  2437. public $useTable = 'Content';
  2438. /**
  2439. * primaryKey property
  2440. *
  2441. * @var string 'iContentId'
  2442. * @access public
  2443. */
  2444. public $primaryKey = 'iContentId';
  2445. /**
  2446. * hasAndBelongsToMany property
  2447. *
  2448. * @var array
  2449. * @access public
  2450. */
  2451. public $hasAndBelongsToMany = array('Account' => array('className' => 'Account', 'with' => 'ContentAccount', 'joinTable' => 'ContentAccounts', 'foreignKey' => 'iContentId', 'associationForeignKey', 'iAccountId'));
  2452. }
  2453. /**
  2454. * Nonconformant Account class
  2455. *
  2456. * @package cake.tests.cases.libs.model
  2457. */
  2458. class Account extends CakeTestModel {
  2459. /**
  2460. * name property
  2461. *
  2462. * @var string 'Account'
  2463. * @access public
  2464. */
  2465. public $name = 'Account';
  2466. /**
  2467. * useTable property
  2468. *
  2469. * @var string 'Account'
  2470. * @access public
  2471. */
  2472. public $useTable = 'Accounts';
  2473. /**
  2474. * primaryKey property
  2475. *
  2476. * @var string 'iAccountId'
  2477. * @access public
  2478. */
  2479. public $primaryKey = 'iAccountId';
  2480. }
  2481. /**
  2482. * Nonconformant ContentAccount class
  2483. *
  2484. * @package cake.tests.cases.libs.model
  2485. */
  2486. class ContentAccount extends CakeTestModel {
  2487. /**
  2488. * name property
  2489. *
  2490. * @var string 'Account'
  2491. * @access public
  2492. */
  2493. public $name = 'ContentAccount';
  2494. /**
  2495. * useTable property
  2496. *
  2497. * @var string 'Account'
  2498. * @access public
  2499. */
  2500. public $useTable = 'ContentAccounts';
  2501. /**
  2502. * primaryKey property
  2503. *
  2504. * @var string 'iAccountId'
  2505. * @access public
  2506. */
  2507. public $primaryKey = 'iContentAccountsId';
  2508. }
  2509. /**
  2510. * FilmFile class
  2511. *
  2512. * @package cake.tests.cases.libs.model
  2513. */
  2514. class FilmFile extends CakeTestModel {
  2515. public $name = 'FilmFile';
  2516. }
  2517. /**
  2518. * Basket test model
  2519. *
  2520. * @package cake.tests.cases.libs.model
  2521. */
  2522. class Basket extends CakeTestModel {
  2523. public $name = 'Basket';
  2524. public $belongsTo = array(
  2525. 'FilmFile' => array(
  2526. 'className' => 'FilmFile',
  2527. 'foreignKey' => 'object_id',
  2528. 'conditions' => "Basket.type = 'file'",
  2529. 'fields' => '',
  2530. 'order' => ''
  2531. )
  2532. );
  2533. }
  2534. /**
  2535. * TestPluginArticle class
  2536. *
  2537. * @package cake.tests.cases.libs.model
  2538. */
  2539. class TestPluginArticle extends CakeTestModel {
  2540. /**
  2541. * name property
  2542. *
  2543. * @var string 'TestPluginArticle'
  2544. * @access public
  2545. */
  2546. public $name = 'TestPluginArticle';
  2547. /**
  2548. * belongsTo property
  2549. *
  2550. * @var array
  2551. * @access public
  2552. */
  2553. public $belongsTo = array('User');
  2554. /**
  2555. * hasMany property
  2556. *
  2557. * @var array
  2558. * @access public
  2559. */
  2560. public $hasMany = array(
  2561. 'TestPluginComment' => array(
  2562. 'className' => 'TestPlugin.TestPluginComment',
  2563. 'foreignKey' => 'article_id',
  2564. 'dependent' => true
  2565. )
  2566. );
  2567. }
  2568. /**
  2569. * TestPluginComment class
  2570. *
  2571. * @package cake.tests.cases.libs.model
  2572. */
  2573. class TestPluginComment extends CakeTestModel {
  2574. /**
  2575. * name property
  2576. *
  2577. * @var string 'TestPluginComment'
  2578. * @access public
  2579. */
  2580. public $name = 'TestPluginComment';
  2581. /**
  2582. * belongsTo property
  2583. *
  2584. * @var array
  2585. * @access public
  2586. */
  2587. public $belongsTo = array(
  2588. 'TestPluginArticle' => array(
  2589. 'className' => 'TestPlugin.TestPluginArticle',
  2590. 'foreignKey' => 'article_id',
  2591. ),
  2592. 'User'
  2593. );
  2594. }
  2595. /**
  2596. * Uuidportfolio class
  2597. *
  2598. * @package cake.tests.cases.libs.model
  2599. */
  2600. class Uuidportfolio extends CakeTestModel {
  2601. /**
  2602. * name property
  2603. *
  2604. * @var string 'Uuidportfolio'
  2605. * @access public
  2606. */
  2607. public $name = 'Uuidportfolio';
  2608. /**
  2609. * hasAndBelongsToMany property
  2610. *
  2611. * @var array
  2612. * @access public
  2613. */
  2614. public $hasAndBelongsToMany = array('Uuiditem');
  2615. }
  2616. /**
  2617. * Uuiditem class
  2618. *
  2619. * @package cake.tests.cases.libs.model
  2620. */
  2621. class Uuiditem extends CakeTestModel {
  2622. /**
  2623. * name property
  2624. *
  2625. * @var string 'Item'
  2626. * @access public
  2627. */
  2628. public $name = 'Uuiditem';
  2629. /**
  2630. * hasAndBelongsToMany property
  2631. *
  2632. * @var array
  2633. * @access public
  2634. */
  2635. public $hasAndBelongsToMany = array('Uuidportfolio' => array('with' => 'UuiditemsUuidportfolioNumericid'));
  2636. }
  2637. /**
  2638. * UuiditemsPortfolio class
  2639. *
  2640. * @package cake.tests.cases.libs.model
  2641. */
  2642. class UuiditemsUuidportfolio extends CakeTestModel {
  2643. /**
  2644. * name property
  2645. *
  2646. * @var string 'ItemsPortfolio'
  2647. * @access public
  2648. */
  2649. public $name = 'UuiditemsUuidportfolio';
  2650. }
  2651. /**
  2652. * UuiditemsPortfolioNumericid class
  2653. *
  2654. * @package cake.tests.cases.libs.model
  2655. */
  2656. class UuiditemsUuidportfolioNumericid extends CakeTestModel {
  2657. /**
  2658. * name property
  2659. *
  2660. * @var string
  2661. * @access public
  2662. */
  2663. public $name = 'UuiditemsUuidportfolioNumericid';
  2664. }
  2665. /**
  2666. * TranslateTestModel class.
  2667. *
  2668. * @package cake.tests.cases.libs.model
  2669. */
  2670. class TranslateTestModel extends CakeTestModel {
  2671. /**
  2672. * name property
  2673. *
  2674. * @var string 'TranslateTestModel'
  2675. * @access public
  2676. */
  2677. public $name = 'TranslateTestModel';
  2678. /**
  2679. * useTable property
  2680. *
  2681. * @var string 'i18n'
  2682. * @access public
  2683. */
  2684. public $useTable = 'i18n';
  2685. /**
  2686. * displayField property
  2687. *
  2688. * @var string 'field'
  2689. * @access public
  2690. */
  2691. public $displayField = 'field';
  2692. }
  2693. /**
  2694. * TranslateTestModel class.
  2695. *
  2696. * @package cake.tests.cases.libs.model
  2697. */
  2698. class TranslateWithPrefix extends CakeTestModel {
  2699. /**
  2700. * name property
  2701. *
  2702. * @var string 'TranslateTestModel'
  2703. * @access public
  2704. */
  2705. public $name = 'TranslateWithPrefix';
  2706. /**
  2707. * tablePrefix property
  2708. *
  2709. * @var string 'i18n'
  2710. * @access public
  2711. */
  2712. public $tablePrefix = 'i18n_';
  2713. /**
  2714. * displayField property
  2715. *
  2716. * @var string 'field'
  2717. * @access public
  2718. */
  2719. public $displayField = 'field';
  2720. }
  2721. /**
  2722. * TranslatedItem class.
  2723. *
  2724. * @package cake.tests.cases.libs.model
  2725. */
  2726. class TranslatedItem extends CakeTestModel {
  2727. /**
  2728. * name property
  2729. *
  2730. * @var string 'TranslatedItem'
  2731. * @access public
  2732. */
  2733. public $name = 'TranslatedItem';
  2734. /**
  2735. * cacheQueries property
  2736. *
  2737. * @var bool false
  2738. * @access public
  2739. */
  2740. public $cacheQueries = false;
  2741. /**
  2742. * actsAs property
  2743. *
  2744. * @var array
  2745. * @access public
  2746. */
  2747. public $actsAs = array('Translate' => array('content', 'title'));
  2748. /**
  2749. * translateModel property
  2750. *
  2751. * @var string 'TranslateTestModel'
  2752. * @access public
  2753. */
  2754. public $translateModel = 'TranslateTestModel';
  2755. }
  2756. /**
  2757. * TranslatedItem class.
  2758. *
  2759. * @package cake.tests.cases.libs.model
  2760. */
  2761. class TranslatedItem2 extends CakeTestModel {
  2762. /**
  2763. * name property
  2764. *
  2765. * @var string 'TranslatedItem'
  2766. * @access public
  2767. */
  2768. public $name = 'TranslatedItem';
  2769. /**
  2770. * cacheQueries property
  2771. *
  2772. * @var bool false
  2773. * @access public
  2774. */
  2775. public $cacheQueries = false;
  2776. /**
  2777. * actsAs property
  2778. *
  2779. * @var array
  2780. * @access public
  2781. */
  2782. public $actsAs = array('Translate' => array('content', 'title'));
  2783. /**
  2784. * translateModel property
  2785. *
  2786. * @var string 'TranslateTestModel'
  2787. * @access public
  2788. */
  2789. public $translateModel = 'TranslateWithPrefix';
  2790. }
  2791. /**
  2792. * TranslatedItemWithTable class.
  2793. *
  2794. * @package cake.tests.cases.libs.model
  2795. */
  2796. class TranslatedItemWithTable extends CakeTestModel {
  2797. /**
  2798. * name property
  2799. *
  2800. * @var string 'TranslatedItemWithTable'
  2801. * @access public
  2802. */
  2803. public $name = 'TranslatedItemWithTable';
  2804. /**
  2805. * useTable property
  2806. *
  2807. * @var string 'translated_items'
  2808. * @access public
  2809. */
  2810. public $useTable = 'translated_items';
  2811. /**
  2812. * cacheQueries property
  2813. *
  2814. * @var bool false
  2815. * @access public
  2816. */
  2817. public $cacheQueries = false;
  2818. /**
  2819. * actsAs property
  2820. *
  2821. * @var array
  2822. * @access public
  2823. */
  2824. public $actsAs = array('Translate' => array('content', 'title'));
  2825. /**
  2826. * translateModel property
  2827. *
  2828. * @var string 'TranslateTestModel'
  2829. * @access public
  2830. */
  2831. public $translateModel = 'TranslateTestModel';
  2832. /**
  2833. * translateTable property
  2834. *
  2835. * @var string 'another_i18n'
  2836. * @access public
  2837. */
  2838. public $translateTable = 'another_i18n';
  2839. }
  2840. /**
  2841. * TranslateArticleModel class.
  2842. *
  2843. * @package cake.tests.cases.libs.model
  2844. */
  2845. class TranslateArticleModel extends CakeTestModel {
  2846. /**
  2847. * name property
  2848. *
  2849. * @var string 'TranslateArticleModel'
  2850. * @access public
  2851. */
  2852. public $name = 'TranslateArticleModel';
  2853. /**
  2854. * useTable property
  2855. *
  2856. * @var string 'article_i18n'
  2857. * @access public
  2858. */
  2859. public $useTable = 'article_i18n';
  2860. /**
  2861. * displayField property
  2862. *
  2863. * @var string 'field'
  2864. * @access public
  2865. */
  2866. public $displayField = 'field';
  2867. }
  2868. /**
  2869. * TranslatedArticle class.
  2870. *
  2871. * @package cake.tests.cases.libs.model
  2872. */
  2873. class TranslatedArticle extends CakeTestModel {
  2874. /**
  2875. * name property
  2876. *
  2877. * @var string 'TranslatedArticle'
  2878. * @access public
  2879. */
  2880. public $name = 'TranslatedArticle';
  2881. /**
  2882. * cacheQueries property
  2883. *
  2884. * @var bool false
  2885. * @access public
  2886. */
  2887. public $cacheQueries = false;
  2888. /**
  2889. * actsAs property
  2890. *
  2891. * @var array
  2892. * @access public
  2893. */
  2894. public $actsAs = array('Translate' => array('title', 'body'));
  2895. /**
  2896. * translateModel property
  2897. *
  2898. * @var string 'TranslateArticleModel'
  2899. * @access public
  2900. */
  2901. public $translateModel = 'TranslateArticleModel';
  2902. /**
  2903. * belongsTo property
  2904. *
  2905. * @var array
  2906. * @access public
  2907. */
  2908. public $belongsTo = array('User');
  2909. }
  2910. class CounterCacheUser extends CakeTestModel {
  2911. public $name = 'CounterCacheUser';
  2912. public $alias = 'User';
  2913. public $hasMany = array('Post' => array(
  2914. 'className' => 'CounterCachePost',
  2915. 'foreignKey' => 'user_id'
  2916. ));
  2917. }
  2918. class CounterCachePost extends CakeTestModel {
  2919. public $name = 'CounterCachePost';
  2920. public $alias = 'Post';
  2921. public $belongsTo = array('User' => array(
  2922. 'className' => 'CounterCacheUser',
  2923. 'foreignKey' => 'user_id',
  2924. 'counterCache' => true
  2925. ));
  2926. }
  2927. class CounterCacheUserNonstandardPrimaryKey extends CakeTestModel {
  2928. public $name = 'CounterCacheUserNonstandardPrimaryKey';
  2929. public $alias = 'User';
  2930. public $primaryKey = 'uid';
  2931. public $hasMany = array('Post' => array(
  2932. 'className' => 'CounterCachePostNonstandardPrimaryKey',
  2933. 'foreignKey' => 'uid'
  2934. ));
  2935. }
  2936. class CounterCachePostNonstandardPrimaryKey extends CakeTestModel {
  2937. public $name = 'CounterCachePostNonstandardPrimaryKey';
  2938. public $alias = 'Post';
  2939. public $primaryKey = 'pid';
  2940. public $belongsTo = array('User' => array(
  2941. 'className' => 'CounterCacheUserNonstandardPrimaryKey',
  2942. 'foreignKey' => 'uid',
  2943. 'counterCache' => true
  2944. ));
  2945. }
  2946. class ArticleB extends CakeTestModel {
  2947. public $name = 'ArticleB';
  2948. public $useTable = 'articles';
  2949. public $hasAndBelongsToMany = array(
  2950. 'TagB' => array(
  2951. 'className' => 'TagB',
  2952. 'joinTable' => 'articles_tags',
  2953. 'foreignKey' => 'article_id',
  2954. 'associationForeignKey' => 'tag_id'
  2955. )
  2956. );
  2957. }
  2958. class TagB extends CakeTestModel {
  2959. public $name = 'TagB';
  2960. public $useTable = 'tags';
  2961. public $hasAndBelongsToMany = array(
  2962. 'ArticleB' => array(
  2963. 'className' => 'ArticleB',
  2964. 'joinTable' => 'articles_tags',
  2965. 'foreignKey' => 'tag_id',
  2966. 'associationForeignKey' => 'article_id'
  2967. )
  2968. );
  2969. }
  2970. class Fruit extends CakeTestModel {
  2971. public $name = 'Fruit';
  2972. public $hasAndBelongsToMany = array(
  2973. 'UuidTag' => array(
  2974. 'className' => 'UuidTag',
  2975. 'joinTable' => 'fruits_uuid_tags',
  2976. 'foreignKey' => 'fruit_id',
  2977. 'associationForeignKey' => 'uuid_tag_id',
  2978. 'with' => 'FruitsUuidTag'
  2979. )
  2980. );
  2981. }
  2982. class FruitsUuidTag extends CakeTestModel {
  2983. public $name = 'FruitsUuidTag';
  2984. public $primaryKey = false;
  2985. public $belongsTo = array(
  2986. 'UuidTag' => array(
  2987. 'className' => 'UuidTag',
  2988. 'foreignKey' => 'uuid_tag_id',
  2989. ),
  2990. 'Fruit' => array(
  2991. 'className' => 'Fruit',
  2992. 'foreignKey' => 'fruit_id',
  2993. )
  2994. );
  2995. }
  2996. class UuidTag extends CakeTestModel {
  2997. public $name = 'UuidTag';
  2998. public $hasAndBelongsToMany = array(
  2999. 'Fruit' => array(
  3000. 'className' => 'Fruit',
  3001. 'joinTable' => 'fruits_uuid_tags',
  3002. 'foreign_key' => 'uuid_tag_id',
  3003. 'associationForeignKey' => 'fruit_id',
  3004. 'with' => 'FruitsUuidTag'
  3005. )
  3006. );
  3007. }
  3008. class FruitNoWith extends CakeTestModel {
  3009. public $name = 'Fruit';
  3010. public $useTable = 'fruits';
  3011. public $hasAndBelongsToMany = array(
  3012. 'UuidTag' => array(
  3013. 'className' => 'UuidTagNoWith',
  3014. 'joinTable' => 'fruits_uuid_tags',
  3015. 'foreignKey' => 'fruit_id',
  3016. 'associationForeignKey' => 'uuid_tag_id',
  3017. )
  3018. );
  3019. }
  3020. class UuidTagNoWith extends CakeTestModel {
  3021. public $name = 'UuidTag';
  3022. public $useTable = 'uuid_tags';
  3023. public $hasAndBelongsToMany = array(
  3024. 'Fruit' => array(
  3025. 'className' => 'FruitNoWith',
  3026. 'joinTable' => 'fruits_uuid_tags',
  3027. 'foreign_key' => 'uuid_tag_id',
  3028. 'associationForeignKey' => 'fruit_id',
  3029. )
  3030. );
  3031. }
  3032. class ProductUpdateAll extends CakeTestModel {
  3033. public $name = 'ProductUpdateAll';
  3034. public $useTable = 'product_update_all';
  3035. }
  3036. class GroupUpdateAll extends CakeTestModel {
  3037. public $name = 'GroupUpdateAll';
  3038. public $useTable = 'group_update_all';
  3039. }
  3040. class TransactionTestModel extends CakeTestModel {
  3041. var $name = 'TransactionTestModel';
  3042. var $useTable = 'samples';
  3043. public function afterSave($created) {
  3044. $data = array(
  3045. array('apple_id' => 1, 'name' => 'sample6'),
  3046. );
  3047. $this->saveAll($data, array('atomic' => true, 'callbacks' => false));
  3048. }
  3049. }
  3050. /**
  3051. * TestModel class
  3052. *
  3053. * @package cake.tests.cases.libs.model.datasources
  3054. */
  3055. class TestModel extends CakeTestModel {
  3056. /**
  3057. * name property
  3058. *
  3059. * @var string 'TestModel'
  3060. * @access public
  3061. */
  3062. public $name = 'TestModel';
  3063. /**
  3064. * useTable property
  3065. *
  3066. * @var bool false
  3067. * @access public
  3068. */
  3069. public $useTable = false;
  3070. /**
  3071. * schema property
  3072. *
  3073. * @var array
  3074. * @access protected
  3075. */
  3076. protected $_schema = array(
  3077. 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
  3078. 'client_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '11'),
  3079. 'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
  3080. 'login' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
  3081. 'passwd' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
  3082. 'addr_1' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
  3083. 'addr_2' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '25'),
  3084. 'zip_code' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
  3085. 'city' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
  3086. 'country' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
  3087. 'phone' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
  3088. 'fax' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
  3089. 'url' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
  3090. 'email' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
  3091. 'comments' => array('type' => 'text', 'null' => '1', 'default' => '', 'length' => '155'),
  3092. 'last_login' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''),
  3093. 'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
  3094. 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
  3095. );
  3096. /**
  3097. * find method
  3098. *
  3099. * @param mixed $conditions
  3100. * @param mixed $fields
  3101. * @param mixed $order
  3102. * @param mixed $recursive
  3103. * @access public
  3104. * @return void
  3105. */
  3106. public function find($conditions = null, $fields = null, $order = null, $recursive = null) {
  3107. return array($conditions, $fields);
  3108. }
  3109. /**
  3110. * findAll method
  3111. *
  3112. * @param mixed $conditions
  3113. * @param mixed $fields
  3114. * @param mixed $order
  3115. * @param mixed $recursive
  3116. * @access public
  3117. * @return void
  3118. */
  3119. public function findAll($conditions = null, $fields = null, $order = null, $recursive = null) {
  3120. return $conditions;
  3121. }
  3122. }
  3123. /**
  3124. * TestModel2 class
  3125. *
  3126. * @package cake.tests.cases.libs.model.datasources
  3127. */
  3128. class TestModel2 extends CakeTestModel {
  3129. /**
  3130. * name property
  3131. *
  3132. * @var string 'TestModel2'
  3133. * @access public
  3134. */
  3135. public $name = 'TestModel2';
  3136. /**
  3137. * useTable property
  3138. *
  3139. * @var bool false
  3140. * @access public
  3141. */
  3142. public $useTable = false;
  3143. }
  3144. /**
  3145. * TestModel4 class
  3146. *
  3147. * @package cake.tests.cases.libs.model.datasources
  3148. */
  3149. class TestModel3 extends CakeTestModel {
  3150. /**
  3151. * name property
  3152. *
  3153. * @var string 'TestModel3'
  3154. * @access public
  3155. */
  3156. public $name = 'TestModel3';
  3157. /**
  3158. * useTable property
  3159. *
  3160. * @var bool false
  3161. * @access public
  3162. */
  3163. public $useTable = false;
  3164. }
  3165. /**
  3166. * TestModel4 class
  3167. *
  3168. * @package cake.tests.cases.libs.model.datasources
  3169. */
  3170. class TestModel4 extends CakeTestModel {
  3171. /**
  3172. * name property
  3173. *
  3174. * @var string 'TestModel4'
  3175. * @access public
  3176. */
  3177. public $name = 'TestModel4';
  3178. /**
  3179. * table property
  3180. *
  3181. * @var string 'test_model4'
  3182. * @access public
  3183. */
  3184. public $table = 'test_model4';
  3185. /**
  3186. * useTable property
  3187. *
  3188. * @var bool false
  3189. * @access public
  3190. */
  3191. public $useTable = false;
  3192. /**
  3193. * belongsTo property
  3194. *
  3195. * @var array
  3196. * @access public
  3197. */
  3198. public $belongsTo = array(
  3199. 'TestModel4Parent' => array(
  3200. 'className' => 'TestModel4',
  3201. 'foreignKey' => 'parent_id'
  3202. )
  3203. );
  3204. /**
  3205. * hasOne property
  3206. *
  3207. * @var array
  3208. * @access public
  3209. */
  3210. public $hasOne = array(
  3211. 'TestModel5' => array(
  3212. 'className' => 'TestModel5',
  3213. 'foreignKey' => 'test_model4_id'
  3214. )
  3215. );
  3216. /**
  3217. * hasAndBelongsToMany property
  3218. *
  3219. * @var array
  3220. * @access public
  3221. */
  3222. public $hasAndBelongsToMany = array('TestModel7' => array(
  3223. 'className' => 'TestModel7',
  3224. 'joinTable' => 'test_model4_test_model7',
  3225. 'foreignKey' => 'test_model4_id',
  3226. 'associationForeignKey' => 'test_model7_id',
  3227. 'with' => 'TestModel4TestModel7'
  3228. ));
  3229. /**
  3230. * schema method
  3231. *
  3232. * @access public
  3233. * @return void
  3234. */
  3235. public function schema($field = false) {
  3236. if (!isset($this->_schema)) {
  3237. $this->_schema = array(
  3238. 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
  3239. 'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
  3240. 'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
  3241. 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
  3242. );
  3243. }
  3244. return $this->_schema;
  3245. }
  3246. }
  3247. /**
  3248. * TestModel4TestModel7 class
  3249. *
  3250. * @package cake.tests.cases.libs.model.datasources
  3251. */
  3252. class TestModel4TestModel7 extends CakeTestModel {
  3253. /**
  3254. * name property
  3255. *
  3256. * @var string 'TestModel4TestModel7'
  3257. * @access public
  3258. */
  3259. public $name = 'TestModel4TestModel7';
  3260. /**
  3261. * table property
  3262. *
  3263. * @var string 'test_model4_test_model7'
  3264. * @access public
  3265. */
  3266. public $table = 'test_model4_test_model7';
  3267. /**
  3268. * useTable property
  3269. *
  3270. * @var bool false
  3271. * @access public
  3272. */
  3273. public $useTable = false;
  3274. /**
  3275. * schema method
  3276. *
  3277. * @access public
  3278. * @return void
  3279. */
  3280. public function schema($field = false) {
  3281. if (!isset($this->_schema)) {
  3282. $this->_schema = array(
  3283. 'test_model4_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
  3284. 'test_model7_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8')
  3285. );
  3286. }
  3287. return $this->_schema;
  3288. }
  3289. }
  3290. /**
  3291. * TestModel5 class
  3292. *
  3293. * @package cake.tests.cases.libs.model.datasources
  3294. */
  3295. class TestModel5 extends CakeTestModel {
  3296. /**
  3297. * name property
  3298. *
  3299. * @var string 'TestModel5'
  3300. * @access public
  3301. */
  3302. public $name = 'TestModel5';
  3303. /**
  3304. * table property
  3305. *
  3306. * @var string 'test_model5'
  3307. * @access public
  3308. */
  3309. public $table = 'test_model5';
  3310. /**
  3311. * useTable property
  3312. *
  3313. * @var bool false
  3314. * @access public
  3315. */
  3316. public $useTable = false;
  3317. /**
  3318. * belongsTo property
  3319. *
  3320. * @var array
  3321. * @access public
  3322. */
  3323. public $belongsTo = array('TestModel4' => array(
  3324. 'className' => 'TestModel4',
  3325. 'foreignKey' => 'test_model4_id'
  3326. ));
  3327. /**
  3328. * hasMany property
  3329. *
  3330. * @var array
  3331. * @access public
  3332. */
  3333. public $hasMany = array('TestModel6' => array(
  3334. 'className' => 'TestModel6',
  3335. 'foreignKey' => 'test_model5_id'
  3336. ));
  3337. /**
  3338. * schema method
  3339. *
  3340. * @access public
  3341. * @return void
  3342. */
  3343. public function schema($field = false) {
  3344. if (!isset($this->_schema)) {
  3345. $this->_schema = array(
  3346. 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
  3347. 'test_model4_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
  3348. 'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
  3349. 'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
  3350. 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
  3351. );
  3352. }
  3353. return $this->_schema;
  3354. }
  3355. }
  3356. /**
  3357. * TestModel6 class
  3358. *
  3359. * @package cake.tests.cases.libs.model.datasources
  3360. */
  3361. class TestModel6 extends CakeTestModel {
  3362. /**
  3363. * name property
  3364. *
  3365. * @var string 'TestModel6'
  3366. * @access public
  3367. */
  3368. public $name = 'TestModel6';
  3369. /**
  3370. * table property
  3371. *
  3372. * @var string 'test_model6'
  3373. * @access public
  3374. */
  3375. public $table = 'test_model6';
  3376. /**
  3377. * useTable property
  3378. *
  3379. * @var bool false
  3380. * @access public
  3381. */
  3382. public $useTable = false;
  3383. /**
  3384. * belongsTo property
  3385. *
  3386. * @var array
  3387. * @access public
  3388. */
  3389. public $belongsTo = array('TestModel5' => array(
  3390. 'className' => 'TestModel5',
  3391. 'foreignKey' => 'test_model5_id'
  3392. ));
  3393. /**
  3394. * schema method
  3395. *
  3396. * @access public
  3397. * @return void
  3398. */
  3399. public function schema($field = false) {
  3400. if (!isset($this->_schema)) {
  3401. $this->_schema = array(
  3402. 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
  3403. 'test_model5_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
  3404. 'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
  3405. 'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
  3406. 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
  3407. );
  3408. }
  3409. return $this->_schema;
  3410. }
  3411. }
  3412. /**
  3413. * TestModel7 class
  3414. *
  3415. * @package cake.tests.cases.libs.model.datasources
  3416. */
  3417. class TestModel7 extends CakeTestModel {
  3418. /**
  3419. * name property
  3420. *
  3421. * @var string 'TestModel7'
  3422. * @access public
  3423. */
  3424. public $name = 'TestModel7';
  3425. /**
  3426. * table property
  3427. *
  3428. * @var string 'test_model7'
  3429. * @access public
  3430. */
  3431. public $table = 'test_model7';
  3432. /**
  3433. * useTable property
  3434. *
  3435. * @var bool false
  3436. * @access public
  3437. */
  3438. public $useTable = false;
  3439. /**
  3440. * schema method
  3441. *
  3442. * @access public
  3443. * @return void
  3444. */
  3445. public function schema($field = false) {
  3446. if (!isset($this->_schema)) {
  3447. $this->_schema = array(
  3448. 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
  3449. 'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
  3450. 'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
  3451. 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
  3452. );
  3453. }
  3454. return $this->_schema;
  3455. }
  3456. }
  3457. /**
  3458. * TestModel8 class
  3459. *
  3460. * @package cake.tests.cases.libs.model.datasources
  3461. */
  3462. class TestModel8 extends CakeTestModel {
  3463. /**
  3464. * name property
  3465. *
  3466. * @var string 'TestModel8'
  3467. * @access public
  3468. */
  3469. public $name = 'TestModel8';
  3470. /**
  3471. * table property
  3472. *
  3473. * @var string 'test_model8'
  3474. * @access public
  3475. */
  3476. public $table = 'test_model8';
  3477. /**
  3478. * useTable property
  3479. *
  3480. * @var bool false
  3481. * @access public
  3482. */
  3483. public $useTable = false;
  3484. /**
  3485. * hasOne property
  3486. *
  3487. * @var array
  3488. * @access public
  3489. */
  3490. public $hasOne = array(
  3491. 'TestModel9' => array(
  3492. 'className' => 'TestModel9',
  3493. 'foreignKey' => 'test_model8_id',
  3494. 'conditions' => 'TestModel9.name != \'mariano\''
  3495. )
  3496. );
  3497. /**
  3498. * schema method
  3499. *
  3500. * @access public
  3501. * @return void
  3502. */
  3503. public function schema($field = false) {
  3504. if (!isset($this->_schema)) {
  3505. $this->_schema = array(
  3506. 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
  3507. 'test_model9_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
  3508. 'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
  3509. 'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
  3510. 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
  3511. );
  3512. }
  3513. return $this->_schema;
  3514. }
  3515. }
  3516. /**
  3517. * TestModel9 class
  3518. *
  3519. * @package cake.tests.cases.libs.model.datasources
  3520. */
  3521. class TestModel9 extends CakeTestModel {
  3522. /**
  3523. * name property
  3524. *
  3525. * @var string 'TestModel9'
  3526. * @access public
  3527. */
  3528. public $name = 'TestModel9';
  3529. /**
  3530. * table property
  3531. *
  3532. * @var string 'test_model9'
  3533. * @access public
  3534. */
  3535. public $table = 'test_model9';
  3536. /**
  3537. * useTable property
  3538. *
  3539. * @var bool false
  3540. * @access public
  3541. */
  3542. public $useTable = false;
  3543. /**
  3544. * belongsTo property
  3545. *
  3546. * @var array
  3547. * @access public
  3548. */
  3549. public $belongsTo = array('TestModel8' => array(
  3550. 'className' => 'TestModel8',
  3551. 'foreignKey' => 'test_model8_id',
  3552. 'conditions' => 'TestModel8.name != \'larry\''
  3553. ));
  3554. /**
  3555. * schema method
  3556. *
  3557. * @access public
  3558. * @return void
  3559. */
  3560. public function schema($field = false) {
  3561. if (!isset($this->_schema)) {
  3562. $this->_schema = array(
  3563. 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
  3564. 'test_model8_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '11'),
  3565. 'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
  3566. 'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
  3567. 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
  3568. );
  3569. }
  3570. return $this->_schema;
  3571. }
  3572. }
  3573. /**
  3574. * Level class
  3575. *
  3576. * @package cake.tests.cases.libs.model.datasources
  3577. */
  3578. class Level extends CakeTestModel {
  3579. /**
  3580. * name property
  3581. *
  3582. * @var string 'Level'
  3583. * @access public
  3584. */
  3585. public $name = 'Level';
  3586. /**
  3587. * table property
  3588. *
  3589. * @var string 'level'
  3590. * @access public
  3591. */
  3592. public $table = 'level';
  3593. /**
  3594. * useTable property
  3595. *
  3596. * @var bool false
  3597. * @access public
  3598. */
  3599. public $useTable = false;
  3600. /**
  3601. * hasMany property
  3602. *
  3603. * @var array
  3604. * @access public
  3605. */
  3606. public $hasMany = array(
  3607. 'Group'=> array(
  3608. 'className' => 'Group'
  3609. ),
  3610. 'User2' => array(
  3611. 'className' => 'User2'
  3612. )
  3613. );
  3614. /**
  3615. * schema method
  3616. *
  3617. * @access public
  3618. * @return void
  3619. */
  3620. public function schema($field = false) {
  3621. if (!isset($this->_schema)) {
  3622. $this->_schema = array(
  3623. 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
  3624. 'name' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => '20'),
  3625. );
  3626. }
  3627. return $this->_schema;
  3628. }
  3629. }
  3630. /**
  3631. * Group class
  3632. *
  3633. * @package cake.tests.cases.libs.model.datasources
  3634. */
  3635. class Group extends CakeTestModel {
  3636. /**
  3637. * name property
  3638. *
  3639. * @var string 'Group'
  3640. * @access public
  3641. */
  3642. public $name = 'Group';
  3643. /**
  3644. * table property
  3645. *
  3646. * @var string 'group'
  3647. * @access public
  3648. */
  3649. public $table = 'group';
  3650. /**
  3651. * useTable property
  3652. *
  3653. * @var bool false
  3654. * @access public
  3655. */
  3656. public $useTable = false;
  3657. /**
  3658. * belongsTo property
  3659. *
  3660. * @var array
  3661. * @access public
  3662. */
  3663. public $belongsTo = array('Level');
  3664. /**
  3665. * hasMany property
  3666. *
  3667. * @var array
  3668. * @access public
  3669. */
  3670. public $hasMany = array('Category2', 'User2');
  3671. /**
  3672. * schema method
  3673. *
  3674. * @access public
  3675. * @return void
  3676. */
  3677. public function schema($field = false) {
  3678. if (!isset($this->_schema)) {
  3679. $this->_schema = array(
  3680. 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
  3681. 'level_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
  3682. 'name' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => '20'),
  3683. );
  3684. }
  3685. return $this->_schema;
  3686. }
  3687. }
  3688. /**
  3689. * User2 class
  3690. *
  3691. * @package cake.tests.cases.libs.model.datasources
  3692. */
  3693. class User2 extends CakeTestModel {
  3694. /**
  3695. * name property
  3696. *
  3697. * @var string 'User2'
  3698. * @access public
  3699. */
  3700. public $name = 'User2';
  3701. /**
  3702. * table property
  3703. *
  3704. * @var string 'user'
  3705. * @access public
  3706. */
  3707. public $table = 'user';
  3708. /**
  3709. * useTable property
  3710. *
  3711. * @var bool false
  3712. * @access public
  3713. */
  3714. public $useTable = false;
  3715. /**
  3716. * belongsTo property
  3717. *
  3718. * @var array
  3719. * @access public
  3720. */
  3721. public $belongsTo = array(
  3722. 'Group' => array(
  3723. 'className' => 'Group'
  3724. ),
  3725. 'Level' => array(
  3726. 'className' => 'Level'
  3727. )
  3728. );
  3729. /**
  3730. * hasMany property
  3731. *
  3732. * @var array
  3733. * @access public
  3734. */
  3735. public $hasMany = array(
  3736. 'Article2' => array(
  3737. 'className' => 'Article2'
  3738. ),
  3739. );
  3740. /**
  3741. * schema method
  3742. *
  3743. * @access public
  3744. * @return void
  3745. */
  3746. public function schema($field = false) {
  3747. if (!isset($this->_schema)) {
  3748. $this->_schema = array(
  3749. 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
  3750. 'group_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
  3751. 'level_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
  3752. 'name' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => '20'),
  3753. );
  3754. }
  3755. return $this->_schema;
  3756. }
  3757. }
  3758. /**
  3759. * Category2 class
  3760. *
  3761. * @package cake.tests.cases.libs.model.datasources
  3762. */
  3763. class Category2 extends CakeTestModel {
  3764. /**
  3765. * name property
  3766. *
  3767. * @var string 'Category2'
  3768. * @access public
  3769. */
  3770. public $name = 'Category2';
  3771. /**
  3772. * table property
  3773. *
  3774. * @var string 'category'
  3775. * @access public
  3776. */
  3777. public $table = 'category';
  3778. /**
  3779. * useTable property
  3780. *
  3781. * @var bool false
  3782. * @access public
  3783. */
  3784. public $useTable = false;
  3785. /**
  3786. * belongsTo property
  3787. *
  3788. * @var array
  3789. * @access public
  3790. */
  3791. public $belongsTo = array(
  3792. 'Group' => array(
  3793. 'className' => 'Group',
  3794. 'foreignKey' => 'group_id'
  3795. ),
  3796. 'ParentCat' => array(
  3797. 'className' => 'Category2',
  3798. 'foreignKey' => 'parent_id'
  3799. )
  3800. );
  3801. /**
  3802. * hasMany property
  3803. *
  3804. * @var array
  3805. * @access public
  3806. */
  3807. public $hasMany = array(
  3808. 'ChildCat' => array(
  3809. 'className' => 'Category2',
  3810. 'foreignKey' => 'parent_id'
  3811. ),
  3812. 'Article2' => array(
  3813. 'className' => 'Article2',
  3814. 'order'=>'Article2.published_date DESC',
  3815. 'foreignKey' => 'category_id',
  3816. 'limit'=>'3')
  3817. );
  3818. /**
  3819. * schema method
  3820. *
  3821. * @access public
  3822. * @return void
  3823. */
  3824. public function schema($field = false) {
  3825. if (!isset($this->_schema)) {
  3826. $this->_schema = array(
  3827. 'id' => array('type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'),
  3828. 'group_id' => array('type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'),
  3829. 'parent_id' => array('type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'),
  3830. 'name' => array('type' => 'string', 'null' => false, 'default' => '', 'length' => '255'),
  3831. 'icon' => array('type' => 'string', 'null' => false, 'default' => '', 'length' => '255'),
  3832. 'description' => array('type' => 'text', 'null' => false, 'default' => '', 'length' => null),
  3833. );
  3834. }
  3835. return $this->_schema;
  3836. }
  3837. }
  3838. /**
  3839. * Article2 class
  3840. *
  3841. * @package cake.tests.cases.libs.model.datasources
  3842. */
  3843. class Article2 extends CakeTestModel {
  3844. /**
  3845. * name property
  3846. *
  3847. * @var string 'Article2'
  3848. * @access public
  3849. */
  3850. public $name = 'Article2';
  3851. /**
  3852. * table property
  3853. *
  3854. * @var string 'article'
  3855. * @access public
  3856. */
  3857. public $table = 'articles';
  3858. /**
  3859. * useTable property
  3860. *
  3861. * @var bool false
  3862. * @access public
  3863. */
  3864. public $useTable = false;
  3865. /**
  3866. * belongsTo property
  3867. *
  3868. * @var array
  3869. * @access public
  3870. */
  3871. public $belongsTo = array(
  3872. 'Category2' => array('className' => 'Category2'),
  3873. 'User2' => array('className' => 'User2')
  3874. );
  3875. /**
  3876. * schema method
  3877. *
  3878. * @access public
  3879. * @return void
  3880. */
  3881. public function schema($field = false) {
  3882. if (!isset($this->_schema)) {
  3883. $this->_schema = array(
  3884. 'id' => array('type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'),
  3885. 'category_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
  3886. 'user_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
  3887. 'rate_count' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
  3888. 'rate_sum' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
  3889. 'viewed' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
  3890. 'version' => array('type' => 'string', 'null' => true, 'default' => '', 'length' => '45'),
  3891. 'title' => array('type' => 'string', 'null' => false, 'default' => '', 'length' => '200'),
  3892. 'intro' => array('text' => 'string', 'null' => true, 'default' => '', 'length' => null),
  3893. 'comments' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '4'),
  3894. 'body' => array('text' => 'string', 'null' => true, 'default' => '', 'length' => null),
  3895. 'isdraft' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'length' => '1'),
  3896. 'allow_comments' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'length' => '1'),
  3897. 'moderate_comments' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'length' => '1'),
  3898. 'published' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'length' => '1'),
  3899. 'multipage' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'length' => '1'),
  3900. 'published_date' => array('type' => 'datetime', 'null' => true, 'default' => '', 'length' => null),
  3901. 'created' => array('type' => 'datetime', 'null' => false, 'default' => '0000-00-00 00:00:00', 'length' => null),
  3902. 'modified' => array('type' => 'datetime', 'null' => false, 'default' => '0000-00-00 00:00:00', 'length' => null)
  3903. );
  3904. }
  3905. return $this->_schema;
  3906. }
  3907. }
  3908. /**
  3909. * CategoryFeatured2 class
  3910. *
  3911. * @package cake.tests.cases.libs.model.datasources
  3912. */
  3913. class CategoryFeatured2 extends CakeTestModel {
  3914. /**
  3915. * name property
  3916. *
  3917. * @var string 'CategoryFeatured2'
  3918. * @access public
  3919. */
  3920. public $name = 'CategoryFeatured2';
  3921. /**
  3922. * table property
  3923. *
  3924. * @var string 'category_featured'
  3925. * @access public
  3926. */
  3927. public $table = 'category_featured';
  3928. /**
  3929. * useTable property
  3930. *
  3931. * @var bool false
  3932. * @access public
  3933. */
  3934. public $useTable = false;
  3935. /**
  3936. * schema method
  3937. *
  3938. * @access public
  3939. * @return void
  3940. */
  3941. public function schema($field = false) {
  3942. if (!isset($this->_schema)) {
  3943. $this->_schema = array(
  3944. 'id' => array('type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'),
  3945. 'parent_id' => array('type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'),
  3946. 'name' => array('type' => 'string', 'null' => false, 'default' => '', 'length' => '255'),
  3947. 'icon' => array('type' => 'string', 'null' => false, 'default' => '', 'length' => '255'),
  3948. 'description' => array('text' => 'string', 'null' => false, 'default' => '', 'length' => null)
  3949. );
  3950. }
  3951. return $this->_schema;
  3952. }
  3953. }
  3954. /**
  3955. * Featured2 class
  3956. *
  3957. * @package cake.tests.cases.libs.model.datasources
  3958. */
  3959. class Featured2 extends CakeTestModel {
  3960. /**
  3961. * name property
  3962. *
  3963. * @var string 'Featured2'
  3964. * @access public
  3965. */
  3966. public $name = 'Featured2';
  3967. /**
  3968. * table property
  3969. *
  3970. * @var string 'featured2'
  3971. * @access public
  3972. */
  3973. public $table = 'featured2';
  3974. /**
  3975. * useTable property
  3976. *
  3977. * @var bool false
  3978. * @access public
  3979. */
  3980. public $useTable = false;
  3981. /**
  3982. * belongsTo property
  3983. *
  3984. * @var array
  3985. * @access public
  3986. */
  3987. public $belongsTo = array(
  3988. 'CategoryFeatured2' => array(
  3989. 'className' => 'CategoryFeatured2'
  3990. )
  3991. );
  3992. /**
  3993. * schema method
  3994. *
  3995. * @access public
  3996. * @return void
  3997. */
  3998. public function schema($field = false) {
  3999. if (!isset($this->_schema)) {
  4000. $this->_schema = array(
  4001. 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
  4002. 'article_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
  4003. 'category_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
  4004. 'name' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => '20')
  4005. );
  4006. }
  4007. return $this->_schema;
  4008. }
  4009. }
  4010. /**
  4011. * Comment2 class
  4012. *
  4013. * @package cake.tests.cases.libs.model.datasources
  4014. */
  4015. class Comment2 extends CakeTestModel {
  4016. /**
  4017. * name property
  4018. *
  4019. * @var string 'Comment2'
  4020. * @access public
  4021. */
  4022. public $name = 'Comment2';
  4023. /**
  4024. * table property
  4025. *
  4026. * @var string 'comment'
  4027. * @access public
  4028. */
  4029. public $table = 'comment';
  4030. /**
  4031. * belongsTo property
  4032. *
  4033. * @var array
  4034. * @access public
  4035. */
  4036. public $belongsTo = array('ArticleFeatured2', 'User2');
  4037. /**
  4038. * useTable property
  4039. *
  4040. * @var bool false
  4041. * @access public
  4042. */
  4043. public $useTable = false;
  4044. /**
  4045. * schema method
  4046. *
  4047. * @access public
  4048. * @return void
  4049. */
  4050. public function schema($field = false) {
  4051. if (!isset($this->_schema)) {
  4052. $this->_schema = array(
  4053. 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
  4054. 'article_featured_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
  4055. 'user_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
  4056. 'name' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => '20')
  4057. );
  4058. }
  4059. return $this->_schema;
  4060. }
  4061. }
  4062. /**
  4063. * ArticleFeatured2 class
  4064. *
  4065. * @package cake.tests.cases.libs.model.datasources
  4066. */
  4067. class ArticleFeatured2 extends CakeTestModel {
  4068. /**
  4069. * name property
  4070. *
  4071. * @var string 'ArticleFeatured2'
  4072. * @access public
  4073. */
  4074. public $name = 'ArticleFeatured2';
  4075. /**
  4076. * table property
  4077. *
  4078. * @var string 'article_featured'
  4079. * @access public
  4080. */
  4081. public $table = 'article_featured';
  4082. /**
  4083. * useTable property
  4084. *
  4085. * @var bool false
  4086. * @access public
  4087. */
  4088. public $useTable = false;
  4089. /**
  4090. * belongsTo property
  4091. *
  4092. * @var array
  4093. * @access public
  4094. */
  4095. public $belongsTo = array(
  4096. 'CategoryFeatured2' => array('className' => 'CategoryFeatured2'),
  4097. 'User2' => array('className' => 'User2')
  4098. );
  4099. /**
  4100. * hasOne property
  4101. *
  4102. * @var array
  4103. * @access public
  4104. */
  4105. public $hasOne = array(
  4106. 'Featured2' => array('className' => 'Featured2')
  4107. );
  4108. /**
  4109. * hasMany property
  4110. *
  4111. * @var array
  4112. * @access public
  4113. */
  4114. public $hasMany = array(
  4115. 'Comment2' => array('className'=>'Comment2', 'dependent' => true)
  4116. );
  4117. /**
  4118. * schema method
  4119. *
  4120. * @access public
  4121. * @return void
  4122. */
  4123. public function schema($field = false) {
  4124. if (!isset($this->_schema)) {
  4125. $this->_schema = array(
  4126. 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'),
  4127. 'category_featured_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
  4128. 'user_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'),
  4129. 'title' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => '20'),
  4130. 'body' => array('text' => 'string', 'null' => true, 'default' => '', 'length' => null),
  4131. 'published' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'length' => '1'),
  4132. 'published_date' => array('type' => 'datetime', 'null' => true, 'default' => '', 'length' => null),
  4133. 'created' => array('type' => 'datetime', 'null' => false, 'default' => '0000-00-00 00:00:00', 'length' => null),
  4134. 'modified' => array('type' => 'datetime', 'null' => false, 'default' => '0000-00-00 00:00:00', 'length' => null)
  4135. );
  4136. }
  4137. return $this->_schema;
  4138. }
  4139. }
  4140. /**
  4141. * MysqlTestModel class
  4142. *
  4143. * @package cake.tests.cases.libs.model.datasources
  4144. */
  4145. class MysqlTestModel extends Model {
  4146. /**
  4147. * name property
  4148. *
  4149. * @var string 'MysqlTestModel'
  4150. * @access public
  4151. */
  4152. public $name = 'MysqlTestModel';
  4153. /**
  4154. * useTable property
  4155. *
  4156. * @var bool false
  4157. * @access public
  4158. */
  4159. public $useTable = false;
  4160. /**
  4161. * find method
  4162. *
  4163. * @param mixed $conditions
  4164. * @param mixed $fields
  4165. * @param mixed $order
  4166. * @param mixed $recursive
  4167. * @access public
  4168. * @return void
  4169. */
  4170. public function find($conditions = null, $fields = null, $order = null, $recursive = null) {
  4171. return $conditions;
  4172. }
  4173. /**
  4174. * findAll method
  4175. *
  4176. * @param mixed $conditions
  4177. * @param mixed $fields
  4178. * @param mixed $order
  4179. * @param mixed $recursive
  4180. * @access public
  4181. * @return void
  4182. */
  4183. public function findAll($conditions = null, $fields = null, $order = null, $recursive = null) {
  4184. return $conditions;
  4185. }
  4186. /**
  4187. * schema method
  4188. *
  4189. * @access public
  4190. * @return void
  4191. */
  4192. public function schema($field = false) {
  4193. return array(
  4194. 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
  4195. 'client_id' => array('type' => 'integer', 'null' => '', 'default' => '0', 'length' => '11'),
  4196. 'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
  4197. 'login' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
  4198. 'passwd' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
  4199. 'addr_1' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
  4200. 'addr_2' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '25'),
  4201. 'zip_code' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
  4202. 'city' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
  4203. 'country' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
  4204. 'phone' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
  4205. 'fax' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
  4206. 'url' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
  4207. 'email' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
  4208. 'comments' => array('type' => 'text', 'null' => '1', 'default' => '', 'length' => ''),
  4209. 'last_login'=> array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''),
  4210. 'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
  4211. 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
  4212. );
  4213. }
  4214. }