models.php 77 KB

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