Giter VIP home page Giter VIP logo

database's Introduction

Baka Database

Baka Database

Scrutinizer Code Quality Code Coverage Build Status

Model

The default behavior of the baka model is giving you the normal functions to work with any mc project

  • automatic updated_at , created_at times
  • soft delete by just calling softDelete() insted of delete()
  • toFullArray() instead of toArray() to avoid dynamic fields on your model been removed by phalcon serialization
  • Custom Fields Trait and CLI
  • Hash Table Traits for dynamic atributes

Custom Fields Model

One of the things we look for is a table that growth in a vertical way instead of horizontal . We made custom fields to avoid having to go later on in proyect and having to add new fields to the table, with this we can managed them dynamicly and later on add UI for the client to better manage the info

To create a custom fields table from a module you will need to use our CLI

To use you need your model to extend from ModelCustomFields

<?php

namespace Canvas\Models;

class Leads extends \Baka\Database\Model
{
    use CustomFieldsTrait;
}

And you also need to create the custom fields model value

<?php

namespace Canvas\Models;

use \Baka\Database\CustomeFieldsInterface;

class LeadsCustomFields extends \Baka\Database\Model implements CustomeFieldsInterface
{
   /**
     * Set the custom primary field id
     *
     * @param int $id
     */
    public function setCustomId(int $id)
    {
        $this->leads_id = $id;
    }
}

Thats it now you can use this custom fields model like any other, no other explication is needed they will work like any phalcon normal model

Hash Tables

Like its name implies, you have a table with key value for any entity you desire. This is usefull when you need to add settings to any tables in your system

<?php

namespace Canvas\Models;

class Leads extends \Baka\Database\Model
{
    use HashTableTrait;
}

database's People

Contributors

kaioken avatar rwhite27 avatar sparohawk avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

evrenbal

database's Issues

Made a change to return a single record when $getById is true. Keeping an eye on...

* @todo: Made a change to return a single record when $getById is true. Keeping an eye on it.
*/
public static function getCustomFields(Model $findResults, $getById = false): array
{
$modelObject = is_object($findResults) ? $findResults : $findResults[0];
$classReflection = (new ReflectionClass($modelObject));


This issue was generated by todo based on a @todo comment in a9a80bb when #5 was merged. cc @bakaphp.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.