CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Team
    • Issues (Github)
    • YouTube Channel
    • Get Involved
    • Bakery
    • Featured Resources
    • Newsletter
    • Certification
    • My CakePHP
    • CakeFest
    • Facebook
    • Twitter
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 3.8 Red Velvet API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 3.8
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Cake
    • Auth
      • Storage
    • Cache
      • Engine
    • Collection
      • Iterator
    • Command
    • Console
      • Exception
    • Controller
      • Component
      • Exception
    • Core
      • Configure
        • Engine
      • Exception
      • Retry
    • Database
      • Driver
      • Exception
      • Expression
      • Schema
      • Statement
      • Type
    • Datasource
      • Exception
    • Error
      • Middleware
    • Event
      • Decorator
    • Filesystem
    • Form
    • Http
      • Client
        • Adapter
        • Auth
      • Cookie
      • Exception
      • Middleware
      • Session
    • I18n
      • Formatter
      • Middleware
      • Parser
    • Log
      • Engine
    • Mailer
      • Exception
      • Transport
    • Network
      • Exception
    • ORM
      • Association
      • Behavior
        • Translate
      • Exception
      • Locator
      • Rule
    • Routing
      • Exception
      • Filter
      • Middleware
      • Route
    • Shell
      • Helper
      • Task
    • TestSuite
      • Fixture
      • Stub
    • Utility
      • Exception
    • Validation
    • View
      • Exception
      • Form
      • Helper
      • Widget
  • None

Classes

  • BinaryType
  • BinaryUuidType
  • BoolType
  • DateTimeType
  • DateType
  • DecimalType
  • FloatType
  • IntegerType
  • JsonType
  • StringType
  • TimeType
  • UuidType

Interfaces

  • BatchCastingInterface
  • ExpressionTypeInterface
  • OptionalConvertInterface

Traits

  • ExpressionTypeCasterTrait
  1: <?php
  2: /**
  3:  * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  4:  * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  5:  *
  6:  * Licensed under The MIT License
  7:  * For full copyright and license information, please see the LICENSE.txt
  8:  * Redistributions of files must retain the above copyright notice.
  9:  *
 10:  * @copyright     Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
 11:  * @link          https://cakephp.org CakePHP(tm) Project
 12:  * @since         3.0.0
 13:  * @license       https://opensource.org/licenses/mit-license.php MIT License
 14:  */
 15: namespace Cake\Database\Type;
 16: 
 17: use DateTime;
 18: 
 19: /**
 20:  * Class DateType
 21:  */
 22: class DateType extends DateTimeType
 23: {
 24:     /**
 25:      * The class to use for representing date objects
 26:      *
 27:      * This property can only be used before an instance of this type
 28:      * class is constructed. After that use `useMutable()` or `useImmutable()` instead.
 29:      *
 30:      * @var string
 31:      * @deprecated 3.2.0 Use DateType::useMutable() or DateType::useImmutable() instead.
 32:      */
 33:     public static $dateTimeClass = 'Cake\I18n\Date';
 34: 
 35:     /**
 36:      * Date format for DateTime object
 37:      *
 38:      * @var string|array
 39:      */
 40:     protected $_format = 'Y-m-d';
 41: 
 42:     /**
 43:      * In this class we want Date objects to  have their time
 44:      * set to the beginning of the day.
 45:      *
 46:      * @var bool
 47:      */
 48:     protected $setToDateStart = true;
 49: 
 50:     /**
 51:      * Change the preferred class name to the FrozenDate implementation.
 52:      *
 53:      * @return $this
 54:      */
 55:     public function useImmutable()
 56:     {
 57:         $this->_setClassName('Cake\I18n\FrozenDate', 'DateTimeImmutable');
 58: 
 59:         return $this;
 60:     }
 61: 
 62:     /**
 63:      * Change the preferred class name to the mutable Date implementation.
 64:      *
 65:      * @return $this
 66:      */
 67:     public function useMutable()
 68:     {
 69:         $this->_setClassName('Cake\I18n\Date', 'DateTime');
 70: 
 71:         return $this;
 72:     }
 73: 
 74:     /**
 75:      * Convert request data into a datetime object.
 76:      *
 77:      * @param mixed $value Request data
 78:      * @return \DateTimeInterface
 79:      */
 80:     public function marshal($value)
 81:     {
 82:         $date = parent::marshal($value);
 83:         if ($date instanceof DateTime) {
 84:             $date->setTime(0, 0, 0);
 85:         }
 86: 
 87:         return $date;
 88:     }
 89: 
 90:     /**
 91:      * {@inheritDoc}
 92:      */
 93:     protected function _parseValue($value)
 94:     {
 95:         /* @var \Cake\I18n\Time $class */
 96:         $class = $this->_className;
 97: 
 98:         return $class::parseDate($value, $this->_localeFormat);
 99:     }
100: }
101: 
Follow @CakePHP
#IRC
OpenHub
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Logos & Trademarks
  • Community
  • Team
  • Issues (Github)
  • YouTube Channel
  • Get Involved
  • Bakery
  • Featured Resources
  • Newsletter
  • Certification
  • My CakePHP
  • CakeFest
  • Facebook
  • Twitter
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs