Giter Site home page Giter Site logo

phalcon / phalcon-devtools Goto Github PK

View Code? Open in Web Editor NEW
1.3K 131.0 631.0 19.7 MB

Phalcon Developer Tools

Home Page: https://docs.phalcon.io/latest/en/devtools

License: Other

PHP 26.06% Shell 0.33% HTML 0.54% Volt 2.83% Batchfile 0.01% CSS 7.96% JavaScript 62.12% Makefile 0.02% Dockerfile 0.13%
phalcon-devtools devtools phalcon ide stubs phalcon-framework phalcon-developer php hacktoberfest

phalcon-devtools's Introduction

Phalcon Devtools

codecov Latest Version Software License Total Downloads Daily Downloads Build Status

Phalcon WebTools

What's Phalcon?

Phalcon PHP is a web framework delivered as a C extension providing high performance and lower resource consumption.

What are Devtools?

This tools provide you useful scripts to generate code helping to develop faster and easy applications that use with Phalcon framework.

Requirements

  • PHP >= 7.2
  • Phalcon >= 4.0.0

Installing via Composer

Install composer in a common location or in your project:

curl -s http://getcomposer.org/installer | php

Create the composer.json file as follows:

{
    "require-dev": {
        "phalcon/devtools": "~4.1"
    }
}

If you are still using Phalcon 3.4.x, create a composer.json with the following instead:

{
    "require-dev": {
        "phalcon/devtools": "^3.4"
    }
}

Run the composer installer:

php composer.phar install

Build .phar

Install composer and box in a common location or in your project:

curl -s http://getcomposer.org/installer | php
bin/composer install

Build phar file phalcon-devtools

bin/box build -v
chmod +xr ./phalcon.phar
# Test it!
php ./phalcon.phar

Installation via Git

Phalcon Devtools can be installed by using Git.

Just clone the repo and checkout the current branch:

cd ~
git clone https://github.com/phalcon/phalcon-devtools.git
cd phalcon-devtools

This method requires a little bit more of setup. Probably the best way would be to symlink the phalcon file to a directory in your PATH, so you can issue phalcon commands in each directory where a phalcon project resides.

cd phalcon-devtools
composer install
ln -s $(pwd)/phalcon /usr/bin/phalcon
chmod ugo+x /usr/bin/phalcon

If you get a "phalcon: command not found" message while creating the symlink, make an alias.

alias phalcon=/home/[USERNAME]/phalcon-devtools/phalcon

Usage

To get a list of available commands just execute following:

phalcon commands help

This command should display something similar to:

$ phalcon --help

Phalcon DevTools (4.1.0)

Help:
  Lists the commands available in Phalcon DevTools

Available commands:
  info             (alias of: i)
  commands         (alias of: list, enumerate)
  controller       (alias of: create-controller)
  module           (alias of: create-module)
  model            (alias of: create-model)
  all-models       (alias of: create-all-models)
  project          (alias of: create-project)
  scaffold         (alias of: create-scaffold)
  migration        (alias of: create-migration)
  webtools         (alias of: create-webtools)
  serve            (alias of: server)
  console          (alias of: shell, psysh)

Database adapter

Should add adapter parameter in your db config file (if you use not MySQL database).

For PostgreSQL it will be something like:

$config = [
  'host'     => 'localhost',
  'dbname'   => 'my_db_name',
  'username' => 'my_db_user',
  'password' => 'my_db_user_password',
  'adapter'  => 'Postgresql'
];

Configuration file

By creating config.json or any other configuration file called config in root project you can set options for all possible commands, for example:

{
  "migration" : {
    "migrations": "App/Migrations",
    "config": "App/Config/db.ini"
  },
  "controller" : {
    "namespace": "Phalcon\\Test",
    "directory": "App/Controllers",
    "base-class": "App\\MyAbstractController"
  }
}

And then you can use phalcon migration run or phalcon controller SomeClass and those commands will be executed with options from file. Arguments provided by developer from command line will overwrite existing one in a file.

License

Phalcon Developer Tools is open source software licensed under the New BSD License.
© Phalcon Framework Team and contributors

phalcon-devtools's People

Contributors

alexbusu avatar andresgutierrez avatar bemyslavedarlin avatar cq-z avatar dacgray avatar dreamsxin avatar dschissler avatar free6k avatar gsouf avatar jeckerson avatar jenovateurs avatar kenjikobe avatar koriseng avatar lenrsmith avatar niden avatar ninjapanzer avatar niterain avatar pgalocha avatar rianorie avatar richmulhern avatar rogervila avatar ruudboon avatar sergeyklay avatar sergeysviridenko avatar sidroberts avatar sjinks avatar thedisco avatar wenchen avatar xboston avatar zinovyev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phalcon-devtools's Issues

Cannot find webtools.config.php

Hi,
I am trying to use webtools but webtools.php requires webtools.config.php which I cannot find anywhere.
Could you please help me with this?

Thanks,
Todor

Models re-creation does not keep comments on methods

For example:

// some model context

/**
 * this comment will disappear after re-creation of models
 * expected behaviour: this comment shoul appear of re-creation
 */
public function initialize()
{
    // this comment will appear after re-creation of models
}

for this example i've used following command:

phalcon all-models --force

P.S. I understand that perhaps it's not easy to write class in a smarty way, but when working with existing project - dropping comments for methods is not very good practice.

Migration error: Multiple primary key defined (mysql)

Table:

CREATE TABLE IF NOT EXISTS `test` (
  `id` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

generated migration:

<?php 

use Phalcon\Db\Column as Column;
use Phalcon\Db\Index as Index;
use Phalcon\Db\Reference as Reference;

class TestMigration_100 extends \Phalcon\Mvc\Model\Migration {

    public function up(){
        $this->morphTable('test', array(
            'columns' => array(
                new Column('id', array(
                    'type' => Column::TYPE_INTEGER,
                    'primary' => true,
                    'notNull' => true,
                    'size' => 11,
                    'first' => true
                ))
            ),
            'indexes' => array(
                new Index('PRIMARY', array(
                    'id'
                ))
            ),
            'options' => array(
                'table_type' => 'BASE TABLE',
                'auto_increment' => '',
                'engine' => 'InnoDB',
                'table_collation' => 'utf8_general_ci'
            )
        ));
    }

}

generated sql:

CREATE TABLE `test` (  `id` INT(11) NOT NULL PRIMARY KEY,  PRIMARY KEY (`id`) )

error: Error: SQLSTATE[42000]: Syntax error or access violation: 1068 Multiple primary key defined

phalcon 1.0.0 and 0.9.1, mysql server version: 5.5.29-0ubuntu0.12.10.1

example fix in /scripts/Phalcon/Mvc/Model/Migration.php s157-159:

//if ($field->isPrimary()) {
//    $fieldDefinition[] = "'primary' => true";
//}

Generate Template files default use PHP itself as the template engine.

Generate Template files default use PHP itself as the template engine.

file:templates/project/simple/services.php

$di->set('view', function() use ($config) {

        $view = new View();

        $view->setViewsDir($config->application->viewsDir);

        $view->registerEngines(array(
                '.volt' => function($view, $di) use ($config) {

                        $volt = new VoltEngine($view, $di);

                        $volt->setOptions(array(
                                'compiledPath' => $config->application->cacheDir,
                                'compiledSeparator' => '_' 
                        )); 

                        return $volt;
                }
        )); 

        return $view;
}, true);

change to:

$di->set('view', function() use ($config) {

        $view = new View();

        $view->setViewsDir($config->application->viewsDir);

        $view->registerEngines(array(
                '.volt' => function($view, $di) use ($config) {

                        $volt = new VoltEngine($view, $di);

                        $volt->setOptions(array(
                                'compiledPath' => $config->application->cacheDir,
                                'compiledSeparator' => '_' 
                        )); 

                        return $volt;
                },  
                '.phtml' => 'Phalcon\Mvc\View\Engine\Php'
        )); 

        return $view;
}, true);

dreamsxin@51c10d6

Custom content gets overwritten in Model classes

Using Phalcon DevTools (1.0.1), any custom content of a model class will be removed when the model is reinitialized by calling
phalcon model [modelname] --force
or
phalcon create-model [modelname] --force

Be it a namespace, a getSource() method or any custom method.
On the website http://docs.phalconphp.com/en/latest/reference/tools.html#generating-models in the generating models video (http://vimeo.com/39213020#) you show that custom content is preserved.

I appologize if I am I missing something, but to me it looks like a not working feature.

Scaffolding is incompatible with getter/setter style models

Example table:

CREATE TABLE `usersTest` (
  `uid` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `email` varchar(255) NOT NULL,
  PRIMARY KEY (`uid`),
  UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

Example model:

<?php


class Userstest extends \Phalcon\Mvc\Model
{

    /**
     * @var integer
     */
    protected $uid;

    /**
     * @var string
     */
    protected $email;

    /**
     * Method to set the value of field uid
     *
     * @param integer $uid
     */
    public function setUid($uid)
    {
        $this->uid = $uid;
        return $this;
    }

    /**
     * Method to set the value of field email
     *
     * @param string $email
     */
    public function setEmail($email)
    {
        $this->email = $email;
        return $this;
    }

    /**
     * Returns the value of field uid
     *
     * @return integer
     */
    public function getUid()
    {
        return $this->uid;
    }

    /**
     * Returns the value of field email
     *
     * @return string
     */
    public function getEmail()
    {
        return $this->email;
    }

    /**
     * Validations and business logic
     */
    public function validation()
    {

        $this->validate(
            new Email(
                array(
                    "field"    => "email",
                    "required" => true,
                )
            )
        );
        if ($this->validationHasFailed() == true) {
            return false;
        }
    }

    /**
     * Initialize method for model.
     */
    public function initialize()
    {
        $this->setSource('usersTest');
    }

}

Examples of failing usage in scaffolding:

            $this->view->uid = $usersTest->uid;

            Tag::setDefault("uid", $usersTest->uid);
            Tag::setDefault("email", $usersTest->email);
        $usersTest = new Userstest();

        $usersTest->uid = $this->request->getPost("uid");
        $usersTest->email = $this->request->getPost("email", "email");

Etc, you get the idea.

Class stubs independent of IDE

I had problem with earlier Netbeans when importing stubs into my projects, but it seems that the recent NetBeans 7.2 can perfectly work with stubs now. Could you move IDE stubs one level higher to reside in "ide" directory instead of "phpstorm"?

multi-module help

When we use help to determine how to use creation of project with command:
phalcon project help we get


Phalcon DevTools (1.2.1)

Help:
Creates a project

Usage:
project [name] [type] [directory] [enable-webtools]

Arguments:
help Shows this help text

Example
phalcon project store simple

Options:
--name Name of the new project
--enable-webtools Determines if webtools should be enabled [optional]
--directory=s Base path on which project will be created [optional]
--type=s Type of the application to be generated (micro, simple, multi-module)


But when we want to use multi-module for type of project we get error.
In the help file is wrong not multi-module change to modules

Cant configure devtools

I've already done some work without webtools in my apps. So I wanted to automtic create migrations.

http://docs.phalconphp.com/en/0.7.0/reference/migrations.html#schema-dumping. i've Downloaded from git master and 0.7.0 releases of devtools and there is no command gen-migration avialable.

Dump of command list:
Available commands:
commands (alias of: list, enumerate)
controller (alias of: create-controller)
model (alias of: create-model)
all-models (alias of: create-all-models)
project (alias of: create-project)
scaffold
migration
webtools

When I tryed to setup webtools, I also got errors. There are nothing detected and 'config' not found, but It included in Di.

Postgres config problem

Warning: pg_query() [function.pg-query]: Query failed: ERROR: unrecognized configuration parameter "tables" in /phalcontools/phalcon-devtools/scripts/WebTools/controllers/ScaffoldController.php on line 28
Phalcon_Db_Exception: "ERROR: unrecognized configuration parameter "tables"" when executing "SHOW TABLES"
#0 /phalcontools/phalcon-devtools/scripts/WebTools/controllers/ScaffoldController.php(28): Phalcon_Db_Adapter_Postgresql->query('SHOW TABLES')
#1 [internal function]: ScaffoldController->indexAction()
#2 [internal function]: call_user_func_array(Array, Array)
#3 [internal function]: Phalcon_Dispatcher->dispatch(Object(Phalcon_Request), Object(Phalcon_Response), Object(Phalcon_View), Object(Phalcon_Model_Manager))
#4 /phalcontools/phalcon-devtools/scripts/WebTools/WebTools.php(151): Phalcon_Controller_Front->dispatchLoop()
#5 /phalconlocalhost.pl/public/webtools.php(33): Phalcon_WebTools::main('/home/sulphur/p...')
#6 {main}

[NFR] add ability to auto-create models with namespaces

For example, i have following table names:

account
account_contact
account_subscription

as an idea - it would be nice to add parameter, that will enforce phalcon create models not like:

Account
AccountContact
AccountSubscription

but as :

Account
Account\Contact
Account\Subscription

Also it would be nice if developers tools were able to define initialize() methods with setSource($table) method...

Generate project add option: template-engine

For example:

Options:
 --name                 Name of the new project
 --enable-webtools      Determines if webtools should be enabled [optional]
 --directory=s          Base path on which project will be created [optional]
 --type=s               Type of the application to be generated (micro, simple, multi-module)
 --template-path        Specify a template path [optional]
 --template-engine=s    Define the template engine, default php (php, volt)
 --use-config-ini       Use a ini file as configuration file [optional]
 --trace                Shows the trace of the framework in case of exception. [optional]
 --help                 Shows this help

webtools template cant find config file in multimodule project

after creating a multimodule project with devtools, using type modules, a structure like this is created:
project \ apps \ frontend \ config

but in scripts\Phalcon\Web\Tools.php (L.200) when generating the webtools for the project an Exception is raised: Cant find config file

in code this script looks for "app/config/config.ini" (didnt check if its a multimodule project)

devtools migration bug?

When I trying to generate the migration I getting an error:

phalcon migration run
Phalcon DevTools (1.1.0)

PHP Notice: Undefined property: Phalcon\Config::$adapter in /home/orion/.phalcon-devtools/scripts/Phalcon/Mvc/Model/Migration.php on line 70
PHP Stack trace:
PHP 1. {main}() /home/orion/.phalcon-devtools/phalcon.php:0
PHP 2. Phalcon\Script->run() /home/orion/.phalcon-devtools/phalcon.php:82
PHP 3. Phalcon\Script->dispatch() /home/orion/.phalcon-devtools/scripts/Phalcon/Script.php:138
PHP 4. Phalcon\Commands\Builtin\Migration->run() /home/orion/.phalcon-devtools/scripts/Phalcon/Script.php:115
PHP 5. Phalcon\Migrations::run() /home/orion/.phalcon-devtools/scripts/Phalcon/Commands/Builtin/Migration.php:96
PHP 6. Phalcon\Mvc\Model\Migration::setup() /home/orion/.phalcon-devtools/scripts/Phalcon/Migrations.php:181
PHP Fatal error: Class '\Phalcon\Db\Adapter\Pdo' not found in /home/orion/.phalcon-devtools/scripts/Phalcon/Mvc/Model/Migration.php on line 71
PHP Stack trace:
PHP 1. {main}() /home/orion/.phalcon-devtools/phalcon.php:0
PHP 2. Phalcon\Script->run() /home/orion/.phalcon-devtools/phalcon.php:82
PHP 3. Phalcon\Script->dispatch() /home/orion/.phalcon-devtools/scripts/Phalcon/Script.php:138
PHP 4. Phalcon\Commands\Builtin\Migration->run() /home/orion/.phalcon-devtools/scripts/Phalcon/Script.php:115
PHP 5. Phalcon\Migrations::run() /home/orion/.phalcon-devtools/scripts/Phalcon/Commands/Builtin/Migration.php:96
PHP 6. Phalcon\Mvc\Model\Migration::setup() /home/orion/.phalcon-devtools/scripts/Phalcon/Migrations.php:181


Runtime Env:
Debian 7.0, PHP 5.4.4-15 (cli) (built: Mar 22 2013 15:41:03), Postgresql 9.1 (db is not exists). Any questions, please, feel free to ask me.

Generated migrations don't adhere to unsigned fields

Suppose a table is created locally with unsigned fields similar to this:

CREATE TABLE `accounts` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(25) NOT NULL DEFAULT '',
  `created_at` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

The resulting migration that is generated for that table will try to create/alter the same table, but the id field would not be set as unsigned, i.e.:

CREATE TABLE `accounts` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(25) NOT NULL DEFAULT '',
  `created_at` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

For the most part, this would not cause issues, but say if the tables were initially imported from a schema file, subsequent migrations will fail when foreign keys are used with the table.

Add create-module command

When using the "modules" project type, there is no way of creating another module inside this project using the command line. It would be nice to have a new module created based on a template (something like frontend, but with empty config files).

Phalcon\Config\Adapter\Ini

Helo there is some problem after enable webtools code in file phalcon-devtools/scripts/Phalcon/Web/Tools.php line 193 new Phalcon\Config\Adapter\Ini($configPath);. Script use namespace
namespace Phalcon\Web so the try to load Phalcon\Web\Phalcon\Config\Adapter\Ini
Line 193 should looks like line 193 new \Phalcon\Config\Adapter\Ini($configPath);

Webtools Not Enabling

[root@localhost www]# phalcon create-project phalcon --enable-webtools

Phalcon DevTools (0.7.0)

Success: Controller "index" was successfully created.

Success: Project "phalcon" was successfully created.

But when I goto http://fw.miloads.com/webtools.php, all I get is

Congratulations!

You're now flying with Phalcon.

Create new model with validators

When create new model with validators, nothing added in "use".
For example, if I create a model of 'users' I have validator 'email' but to use the class Email, i need to add use Phalcon\Mvc\Model\Validator\Email;

Use Postgresql, has been Error: SQLSTATE[08006] [7] invalid connection option "adapter"

phalcon create-model --name accounts

Phalcon DevTools (1.0.0)

Error: SQLSTATE[08006] [7] invalid connection option "adapter"

file:scripts/Phalcon/Builder/Model.php
line:178

                 $db = new $adapterName($configArray);

change:

                 unset($configArray['adapter']);
                 $db = new $adapterName($configArray);

and,line:178

                if (isset($this->_options['schema'])) {
                        if ($this->_options['schema'] != $config->database->dbname) {
                                $initialize[] = "\t\t\$this->setSchema(\"{$this->_options['schema']}\");";
                        }           
                        $schema = $this->_options['schema'];
                } else {    
                        $schema = $config->database->dbname;
                } 

change:

               if (isset($this->_options['schema'])) {
                        if ($this->_options['schema'] != $config->database->dbname) {
                                $initialize[] = "\t\t\$this->setSchema(\"{$this->_options['schema']}\");";
                        }           
                        $schema = $this->_options['schema'];
                } elseif ($adapter == 'Postgresql') {
                        $schema = 'public';
                }  else {
                        $schema = $config->database->dbname;
                }

Inconsistent Template File Generation

Create project creates a skeleton based on volt templates.
The config/services.php is setup to load the volt engine.
The main view is index.volt

Running the scaffold command generates .phtml files and not .volt files. Thus, the layouts don't really work unless manually converting all the files to .volt templates, or disabling the volt engine and converting the main layout to a .phtml file.

A user should probably have the option to generate .volt or .phtml in commands that generate template files.

Migration error: decimal column type

My English is not very good, so I apologize.

Table structure is:

CREATE TABLE `payments` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `comment` varchar(255) DEFAULT NULL,
  `type` int(11) NOT NULL,
  `date` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Generated migration for this table structure:

$this->morphTable('payments', array(
    'columns' => array(
        // ... 
        new Column('amount', array(
            'type' => Column::TYPE_DECIMAL,
            'notNull' => true,
            'size' => 10,
            'after' => 'user_id'
        )),
        // ...
    ),
    // ...
));

How i understand, Migration generator must generate Scale field. Because when i run migration result is:

...
  `amount` decimal(10,0) NOT NULL
...

Please help:)

Webtools: PHP warning when generating new models

When using Phalcon Webtools to generate new models, a following warning is generated:

"Warning: Illegal string offset 'Field' in C:\inetpub\wwwroot\Tools\phalcon-dev-tools\scripts\Phalcon\Builder\AllModels.php on line 125"

Environment:

  • PHP 5.4
  • IIS 7.5

The warrning ONLY appears when selecting All Table names and ticking the Define Relations box.

Problem running dev tools

Hi,

I received the following error with dev tools on command:
phalcon commands
ERROR: Phalcon extension isn't installed, follow these instructions to install it: http://phalconphp.com/documentation/install

I use Ubuntu Linux server, PHP 5.3, Phalcon 0.9
I have the invo app installed and it works without any problem

Regards,
Todor

Fix stubs

  1. add @return static to Phalcon\Mvc\Model\Criteria::fromInput
  2. add implements XXXInterface to classes DI, Flash, Escaper and others..

Can't enable webtools

./phalcon.sh project test3 --directory=/var/www/phalcon --enable-webtools

create the "test3" directory structure without any webtools stuff

phalcon v0.5.0 and phalcon-devtools v0.5.0

Webtools cannot generate scaffold or models for postgresql

I am using
windows 7 , IIS 7.5, phalcon 1.2 nts dll,postgresql 9.2
when generating scaffold or a model for a postgresql database tables, it gives a 'table does not exist' message,although the table is listed in the select input.
image
And the wierd thing is that scaffolding mysql database in the same machine is working properly

Model::hasManyToMany ide stub is wrong/out of date

The current IDE stub docblock referser to the 6th parameter for Phalcon\Mvc\Model::hasManyToMany as array $options but passing in an array causes an error; and the example clearly passes in a string 'id'

        /**
         * Setup a relation n-n between two models through an intermediate relation
         *
         *<code>
         *
         *class Robots extends \Phalcon\Mvc\Model
         *{
         *
         *   public function initialize()
         *   {
         *       //Setup a many-to-many relation to Parts through RobotsParts
         *       $this->hasManyToMany(
         *          'id',
         *          'RobotsParts',
         *          'robots_id',
         *          'parts_id',
         *          'Parts',
         *          'id'
         *      );
         *   }
         *
         *}
         *</code>
         *
         * @param string $fields
         * @param string $intermediateModel
         * @param string $intermediateFields
         * @param string $intermediateReferencedFields
         * @param string $referencedModel
         * @param   array $options
         * @return  \Phalcon\Mvc\Model\Relation
         */
        protected function hasManyToMany(){ }

Migration problem: database type length.

Migration script doesn't support length of type varchar (or any other) , for example if we have table:

CREATE TABLE IF NOT EXISTS users (
id int(11) NOT NULL AUTO_INCREMENT,
username varchar(64) NOT NULL,
password varchar(32) NOT NULL,
email varchar(128) NOT NULL,
creation_date datetime NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Generating migration file from this table and runing migration script show's that (varchar's length is 0):

CREATE TABLE IF NOT EXISTS users (
id int(11) NOT NULL AUTO_INCREMENT,
username varchar(0) NOT NULL,
password varchar(0) NOT NULL,
email varchar(0) NOT NULL,
creation_date date NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

Adding to file /Mvc/Model/Migration.php (169) lines will solve that:

        if ($field->getSize()) {
            $fieldDefinition[] = "'size' => " . $field->getSize();
        }

class Color not found

Fatal error: Class 'Phalcon\Script\Color' not found

I found the problem !!!!, you are using the Color class to show this error

"Phalcon extension isn't installed, follow these instructions to install it: http://phalconphp.com/documentation/install"

The Color class is part of the extension , so you never see the real error, instead you see the class not found.

Stub issue

following is invalid according to stub:
$acl->addRole(new Phalcon\Acl\Role('guest'));
second parameter should become optional

also :

'btn btn-primary btn-large btn-success', )) ?>

according to stub signature: (public static function Tag::linkTo($parameters, $text) ) is invalid

It seems a lot of optional parameter is not specified in stubs

PHP Parse error: syntax error, unexpected '$'

phalcon scaffold --table-name=test

Phalcon DevTools (1.0.0)

PHP Parse error: syntax error, unexpected '$' in /home/test/phalcon-devtools/scripts/Phalcon/Builder/Scaffold.php on line 479

and it can not be used for Postgresql.

[NFR] multiple databases support

We should be able, when generating model, to choose wich database connection to use.
The created model should have the code to initialize the right db connection.
($this->setConnectionService('dbPostgres'); for example)

Foreign key

Phalcon DevTools v0.9.1

phalcon all-models --fk --relations

generates models like this

<?php
class Articles extends \Phalcon\Mvc\Model 
{
    public $id;

    // ...

    public function initialize()
    {
        $this->belongsTo("id", "Objects", "id");
        $this->addForeignKey("id", "Objects", "id");
        $this->addForeignKey("owner_id", "Objects", "id");
    }
}

But method \Phalcon\Mvc\Model::addForeignKey doesn't exist.
Is it deprecated?

If so, how should I set foreign keys?

PDOException: SQLSTATE[08006] [7] invalid connection option "name"

error

config/config.php

<?php

return new \Phalcon\Config(array(
        'database' => array(
                'adapter'  => 'Postgresql',
                'host'     => 'localhost',
                'username' => 'test',
                'password' => 'test',
                'name'     => 'wxservice',
        ),
        'application' => array(
                'controllersDir' => __DIR__ . '/../../app/controllers/',
                'modelsDir'      => __DIR__ . '/../../app/models/',
                'viewsDir'       => __DIR__ . '/../../app/views/',
                'pluginsDir'     => __DIR__ . '/../../app/plugins/',
                'libraryDir'     => __DIR__ . '/../../app/library/',
                'baseUri'        => '/',
        ),
        'models' => array(
                'metadata' => array(
                        'adapter' => 'Memory'
                )
        )
));

no phalcon commands in phostorm

Hi,

I'm trying to use phalcon commands in phpstorm but i have an issue :
phpstorm 5.0.1
cphalcon 0.5.0
php 5.4.7
phalcon-devtools 0.5.0

So,

I don't have command list when i type :
phalcon commands

i have an error :

Phalcon DevTools (0.5.0)

PHP Notice: Undefined property: Phalcon\Commands\Builtin\Enumerate::$_possibleParameters in /Users/steve/git/phalcon-devtools/scripts/Phalcon/Commands/Command.php on line 132
PHP Warning: Invalid argument supplied for foreach() in /Users/steve/git/phalcon-devtools/scripts/Phalcon/Commands/Command.php on line 136

Notice: Undefined property: Phalcon\Commands\Builtin\Enumerate::$_possibleParameters in /Users/steve/git/phalcon-devtools/scripts/Phalcon/Commands/Command.php on line 132

Warning: Invalid argument supplied for foreach() in /Users/steve/git/phalcon-devtools/scripts/Phalcon/Commands/Command.php on line 136
Help:
Lists the commands availables in Phalcon devtools


it look like if : _possibleParameters was missing in abstrac class Command.php

PHP Fatal error: Class 'Phalcon_exception' not found in

Hello,

I getting following error when I create new project.

PHP Fatal error: Class 'Phalcon_exception' not found in

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\Riz>phalcon
-- Available commands:
----------------------
  • all-models
  • controller
  • enable-webtools
  • migrate
  • migration
  • model
  • project
  • scaffold
  • scaffold-bootstrap

D:\wamp\www>phalcon project phalcontry
PHP Fatal error: Class 'Phalcon_Exception' not found in D:\phalcon-devtools\scr
ipts\Script\ScriptException.php on line 33
PHP Stack trace:
PHP 1. {main}() D:\phalcon-devtools\phalcon.php:0
PHP 2. require() D:\phalcon-devtools\phalcon.php:63
PHP 3. require() D:\phalcon-devtools\scripts\project.php:26
PHP 4. require() D:\phalcon-devtools\scripts\Script\Script.php:21

Fatal error: Class 'Phalcon_Exception' not found in D:\phalcon-devtools\scripts
Script\ScriptException.php on line 33

Call Stack:
0.0005 649744 1. {main}() D:\phalcon-devtools\phalcon.php:0
0.0171 684440 2. require('D:\phalcon-devtools\scripts\project.php') D:
\phalcon-devtools\phalcon.php:63
0.0211 808336 3. require('D:\phalcon-devtools\scripts\Script\Script.ph
p') D:\phalcon-devtools\scripts\project.php:26
0.0224 811248 4. require('D:\phalcon-devtools\scripts\Script\ScriptExc
eption.php') D:\phalcon-devtools\scripts\Script\Script.php:21

$config->database->name and dbname naming error

Throughout the project, the database name is referenced by two different names:

sometimes as $config->database->name as in
/phalcon-devtools/scripts/Phalcon/Builder/ScaffoldDBM.php on line: 87

$di->set('db', function() use ($adapter, $config) {
    $adapter = '\\Phalcon\\Db\\Adapter\\Pdo\\' . $adapter;
    $connection = new $adapter(array(
        'host'     => $config->database->host,
        'username' => $config->database->username,
        'password' => $config->database->password,
        'dbname'     => $config->database->name,
    ));
    return $connection;
});

and sometimes as $config->database->dbname
/phalcon-devtools/templates/project/micro/services.php on line: 31

/**
 * Database connection is created based in the parameters defined in the configuration file
 */
$di['db'] = function() use ($config) {
    return new DbAdapter(array(
        "host" => $config->database->host,
        "username" => $config->database->username,
        "password" => $config->database->password,
        "dbname" => $config->database->dbname
    ));
};

that gave me an error on latest update.

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.