OrangeComponent.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  4. * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
  5. *
  6. * Licensed under The MIT License
  7. * Redistributions of files must retain the above copyright notice.
  8. *
  9. * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
  10. * @link http://cakephp.org CakePHP(tm) Project
  11. * @since 3.0.0
  12. * @license http://www.opensource.org/licenses/mit-license.php MIT License
  13. */
  14. namespace TestApp\Controller\Component;
  15. use Cake\Controller\Component;
  16. use Cake\Controller\Controller;
  17. use Cake\Event\Event;
  18. /**
  19. * OrangeComponent class
  20. *
  21. */
  22. class OrangeComponent extends Component
  23. {
  24. /**
  25. * components property
  26. *
  27. * @var array
  28. */
  29. public $components = ['Banana'];
  30. /**
  31. * initialize method
  32. *
  33. * @param array $config
  34. * @return void
  35. */
  36. public function initialize(array $config)
  37. {
  38. $this->Controller = $this->_registry->getController();
  39. $this->Banana->testField = 'OrangeField';
  40. }
  41. /**
  42. * startup method
  43. *
  44. * @param Event $event
  45. * @return string
  46. */
  47. public function startup(Event $event)
  48. {
  49. $this->Controller->foo = 'pass';
  50. }
  51. }